partial_deposit = <Deposit: {'id': 81, 'reception_date': datetime.datetime(2020, 11, 20, 14, 55, 6, 971926, tzinfo=<UTC>), 'collection': 'test', 'external_id': 'external-id-partial', 'client': 'test', 'status': 'partial'}>
authenticated_client = <rest_framework.test.APIClient object at 0x7f2d3c020198>
atom_dataset = {'codemeta-sample': '<?xml version="1.0"?>\n <entry xmlns="http://www.w3.org/2005/Atom"\n xmlns:d...ntry>\n', 'entry-data-empty-body': '<?xml version="1.0"?>\n<entry xmlns="http://www.w3.org/2005/Atom"></entry>\n', ...}
def test_add_metadata_to_unknown_collection(
partial_deposit, authenticated_client, atom_dataset
):
"""Replacing metadata to unknown deposit should return a 404 response
"""
deposit = partial_deposit
unknown_collection_name = "unknown-collection"
try:
DepositCollection.objects.get(name=unknown_collection_name)
except DepositCollection.DoesNotExist:
assert True
url = reverse(SE_IRI, args=[unknown_collection_name, deposit.id])
response = authenticated_client.post(
url,
content_type="application/atom+xml;type=entry",
data=atom_dataset["entry-data1"],
)
assert response.status_code == status.HTTP_404_NOT_FOUND
response_content = parse_xml(response.content)
> assert "Unknown collection name" in response_content["sword:error"]["atom:summary"]
E KeyError: 'atom:summary'
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_deposit_update.py:389: KeyError
TEST RESULT
TEST RESULT
- Run At
- Nov 20 2020, 3:55 PM