authenticated_client = <rest_framework.test.APIClient object at 0x7f021c664048>
deposit_collection = <DepositCollection: {'id': 24, '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_post_deposit_atom_400_both_create_origin_and_add_to_origin(
authenticated_client, deposit_collection, atom_dataset
):
"""Posting a badly formatted atom should return a 400 response
"""
response = post_atom(
authenticated_client,
reverse(COL_IRI, args=[deposit_collection.name]),
data=atom_dataset["entry-data-with-both-create-origin-and-add-to-origin"],
)
assert response.status_code == status.HTTP_400_BAD_REQUEST
> assert (
b"<swh:create_origin> and <swh:add_to_origin> "
b"are mutually exclusive"
) in response.content
E assert b'<swh:create_origin> and <swh:add_to_origin> are mutually exclusive' 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:213: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 24 2022, 10:00 AM