authenticated_client = <rest_framework.test.APIClient object at 0x7fb007834828>
deposit_collection = <DepositCollection: {'id': 29, '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_with_mismatched_slug_and_external_identifier(
authenticated_client, deposit_collection, atom_dataset
):
"""Posting an atom entry with mismatched slug header and external_identifier
should return a 400
"""
external_id = "foobar"
url = reverse(COL_IRI, args=[deposit_collection.name])
# when
response = post_atom(
authenticated_client,
url,
data=atom_dataset["error-with-external-identifier"] % external_id,
HTTP_IN_PROGRESS="false",
HTTP_SLUG="something",
)
> assert (
b"The <external_identifier> tag and Slug header are deprecated"
in response.content
)
E assert b'The <external_identifier> tag and Slug header are deprecated' 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:349: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 23 2022, 3:56 PM