Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/api/test_collection_post_metadata.py
Show First 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | response = authenticated_client.post( | ||||
content_type="application/atom+xml;type=entry", | content_type="application/atom+xml;type=entry", | ||||
data=xml_data, | data=xml_data, | ||||
) | ) | ||||
assert response.status_code == status.HTTP_201_CREATED | assert response.status_code == status.HTTP_201_CREATED | ||||
response_content = parse_xml(BytesIO(response.content)) | response_content = parse_xml(BytesIO(response.content)) | ||||
# Ensure the deposit is finalized | # Ensure the deposit is finalized | ||||
deposit_id = int(response_content["deposit_id"]) | deposit_id = int(response_content["swh:deposit_id"]) | ||||
deposit = Deposit.objects.get(pk=deposit_id) | deposit = Deposit.objects.get(pk=deposit_id) | ||||
assert isinstance(swhid_core, SWHID) | assert isinstance(swhid_core, SWHID) | ||||
assert deposit.swhid == str(swhid_core) | assert deposit.swhid == str(swhid_core) | ||||
assert deposit.swhid_context == str(swhid_reference) | assert deposit.swhid_context == str(swhid_reference) | ||||
assert deposit.complete_date == deposit.reception_date | assert deposit.complete_date == deposit.reception_date | ||||
assert deposit.complete_date is not None | assert deposit.complete_date is not None | ||||
assert deposit.status == DEPOSIT_STATUS_LOAD_SUCCESS | assert deposit.status == DEPOSIT_STATUS_LOAD_SUCCESS | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | response = authenticated_client.post( | ||||
reverse(COL_IRI, args=[deposit_collection.name]), | reverse(COL_IRI, args=[deposit_collection.name]), | ||||
content_type="application/atom+xml;type=entry", | content_type="application/atom+xml;type=entry", | ||||
data=xml_data, | data=xml_data, | ||||
) | ) | ||||
assert response.status_code == status.HTTP_201_CREATED | assert response.status_code == status.HTTP_201_CREATED | ||||
response_content = parse_xml(BytesIO(response.content)) | response_content = parse_xml(BytesIO(response.content)) | ||||
# Ensure the deposit is finalized | # Ensure the deposit is finalized | ||||
deposit_id = int(response_content["deposit_id"]) | deposit_id = int(response_content["swh:deposit_id"]) | ||||
deposit = Deposit.objects.get(pk=deposit_id) | deposit = Deposit.objects.get(pk=deposit_id) | ||||
# we got not swhid as input so we cannot have those | # we got not swhid as input so we cannot have those | ||||
assert deposit.swhid is None | assert deposit.swhid is None | ||||
assert deposit.swhid_context is None | assert deposit.swhid_context is None | ||||
assert deposit.complete_date == deposit.reception_date | assert deposit.complete_date == deposit.reception_date | ||||
assert deposit.complete_date is not None | assert deposit.complete_date is not None | ||||
assert deposit.status == DEPOSIT_STATUS_LOAD_SUCCESS | assert deposit.status == DEPOSIT_STATUS_LOAD_SUCCESS | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |