tmp_path = '/tmp/pytest-of-jenkins/pytest-0/test_put_update_metadata_done_4'
authenticated_client = <rest_framework.test.APIClient object at 0x7f91b64210f0>
complete_deposit = <Deposit: {'id': 68, 'reception_date': datetime.datetime(2020, 9, 26, 16, 59, 48, 142728, tzinfo=<UTC>), 'collection': 'test', 'external_id': 'external-id-complete', 'client': 'test', 'status': 'done'}>
deposit_collection = <DepositCollection: {'id': 81, 'name': 'test'}>
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', ...}
swh_storage = <swh.storage.postgresql.storage.Storage object at 0x7f91b6421ba8>
def test_put_update_metadata_done_deposit_failure_empty_xml(
tmp_path,
authenticated_client,
complete_deposit,
deposit_collection,
atom_dataset,
swh_storage,
):
"""failure: client updates metadata on deposit done with an empty xml.
Response: 400
"""
update_uri = reverse(
EDIT_SE_IRI, args=[deposit_collection.name, complete_deposit.id]
)
response = authenticated_client.put(
update_uri,
content_type="application/atom+xml;type=entry",
data=atom_dataset["entry-data-empty-body"],
HTTP_X_CHECK_SWHID=complete_deposit.swh_id,
)
assert response.status_code == status.HTTP_400_BAD_REQUEST
> assert b"Empty body request is not supported" in response.content
E assert b'Empty body request is not supported' in b'<?xml version="1.0" encoding="utf-8"?>\n<sword:error xmlns="http://www.w3.org/2005/Atom"\n xmlns:sword="http:/...ctory SWHID in SWH archive. Please provide an existing SWHID.\n </sword:verboseDescription>\n \n</sword:error>\n'
E + where b'<?xml version="1.0" encoding="utf-8"?>\n<sword:error xmlns="http://www.w3.org/2005/Atom"\n xmlns:sword="http:/...ctory SWHID in SWH archive. Please provide an existing SWHID.\n </sword:verboseDescription>\n \n</sword:error>\n' = <HttpResponse status_code=400, "application/xml">.content
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_deposit_update.py:321: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Sep 26 2020, 7:00 PM