authenticated_client = <rest_framework.test.APIClient object at 0x7f3049d7e0b8>
deposit_collection = <DepositCollection: {'id': 36, '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', ...}
def test_deposit_metadata_fails_functional_checks(
authenticated_client, deposit_collection, atom_dataset
):
"""Posting functionally invalid metadata swhid is bad request returned to client
"""
swhid = "swh:1:dir:31b5c8cc985d190b5a7ef4878128ebfdc2358f49"
invalid_xml_data = atom_dataset[
"entry-data-with-swhid-fail-metadata-functional-checks"
].format(swhid=swhid)
response = post_atom(
authenticated_client,
reverse(COL_IRI, args=[deposit_collection.name]),
data=invalid_xml_data,
)
assert response.status_code == status.HTTP_400_BAD_REQUEST
> assert b"Functional metadata checks failure" in response.content
E assert b'Functional metadata checks failure' in b'<?xml version="1.0" encoding="utf-8"?>\n<sword:error xmlns="http://www.w3.org/2005/Atom"\n xmlns:sword="...med. Please ensure your metadata file is correctly formatted.\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="...med. Please ensure your metadata file is correctly formatted.\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_collection_post_atom.py:536: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 23 2022, 1:52 PM