Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/api/test_collection_post_atom.py
Show First 20 Lines • Show All 291 Lines • ▼ Show 20 Lines | ): | ||||
# one associated request to a deposit | # one associated request to a deposit | ||||
deposit_requests = DepositRequest.objects.filter(deposit=deposit) | deposit_requests = DepositRequest.objects.filter(deposit=deposit) | ||||
assert len(deposit_requests) == 1 | assert len(deposit_requests) == 1 | ||||
atom_entry_data = atom_dataset["entry-data-minimal"] % external_id.encode( | atom_entry_data = atom_dataset["entry-data-minimal"] % external_id.encode( | ||||
"utf-8" | "utf-8" | ||||
) # noqa | ) # noqa | ||||
update_uri = response._headers["location"][1] | for link in response_content["link"]: | ||||
if link["@rel"] == "http://purl.org/net/sword/terms/add": | |||||
se_iri = link["@href"] | |||||
break | |||||
else: | |||||
assert False, f"missing SE-IRI from {response_content['link']}" | |||||
# when updating the first deposit post | # when updating the first deposit post | ||||
response = authenticated_client.post( | response = authenticated_client.post( | ||||
update_uri, | se_iri, | ||||
content_type="application/atom+xml;type=entry", | content_type="application/atom+xml;type=entry", | ||||
data=atom_entry_data, | data=atom_entry_data, | ||||
HTTP_IN_PROGRESS="False", | HTTP_IN_PROGRESS="False", | ||||
) | ) | ||||
# then | # then | ||||
assert response.status_code == status.HTTP_201_CREATED | assert response.status_code == status.HTTP_201_CREATED | ||||
Show All 25 Lines |