authenticated_client = <rest_framework.test.APIClient object at 0x7f304a2c1dd8>
deposit_collection = <DepositCollection: {'id': 20, '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_with_empty_body(
authenticated_client, deposit_collection, atom_dataset
):
"""Posting empty body request should return a 400 response
"""
atom_content = atom_dataset["entry-data-empty-body"]
response = post_atom(
authenticated_client,
reverse(COL_IRI, args=[deposit_collection.name]),
data=atom_content,
HTTP_SLUG="external-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="...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:149: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 23 2022, 1:52 PM