Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/api/test_deposit_update.py
Show All 12 Lines | |||||
from swh.deposit.config import ( | from swh.deposit.config import ( | ||||
DEPOSIT_STATUS_DEPOSITED, | DEPOSIT_STATUS_DEPOSITED, | ||||
DEPOSIT_STATUS_PARTIAL, | DEPOSIT_STATUS_PARTIAL, | ||||
EDIT_IRI, | EDIT_IRI, | ||||
SE_IRI, | SE_IRI, | ||||
) | ) | ||||
from swh.deposit.models import Deposit, DepositRequest | from swh.deposit.models import Deposit, DepositRequest | ||||
from swh.deposit.tests.common import post_atom | |||||
def test_add_both_archive_and_metadata_to_deposit( | def test_add_both_archive_and_metadata_to_deposit( | ||||
authenticated_client, | authenticated_client, | ||||
deposit_collection, | deposit_collection, | ||||
partial_deposit_with_metadata, | partial_deposit_with_metadata, | ||||
atom_dataset, | atom_dataset, | ||||
sample_archive, | sample_archive, | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | ): | ||||
Response: 200 | Response: 200 | ||||
""" | """ | ||||
deposit = partial_deposit_with_metadata | deposit = partial_deposit_with_metadata | ||||
assert deposit.status == DEPOSIT_STATUS_PARTIAL | assert deposit.status == DEPOSIT_STATUS_PARTIAL | ||||
update_uri = reverse(SE_IRI, args=[deposit_collection.name, deposit.id]) | update_uri = reverse(SE_IRI, args=[deposit_collection.name, deposit.id]) | ||||
response = authenticated_client.post( | response = post_atom( | ||||
update_uri, | authenticated_client, update_uri, data="", size=0, HTTP_IN_PROGRESS=False, | ||||
content_type="application/atom+xml;type=entry", | |||||
data="", | |||||
size=0, | |||||
HTTP_IN_PROGRESS=False, | |||||
) | ) | ||||
assert response.status_code == status.HTTP_200_OK | assert response.status_code == status.HTTP_200_OK | ||||
deposit = Deposit.objects.get(pk=deposit.id) | deposit = Deposit.objects.get(pk=deposit.id) | ||||
assert deposit.status == DEPOSIT_STATUS_DEPOSITED | assert deposit.status == DEPOSIT_STATUS_DEPOSITED | ||||
def test_put_update_metadata_and_archive_deposit_partial_nominal( | def test_put_update_metadata_and_archive_deposit_partial_nominal( | ||||
▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines |