authenticated_client = <rest_framework.test.APIClient object at 0x7fc00b541080>
deposit_collection = <DepositCollection: {'id': 21, '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', ...}
deposit_user = <DepositClient: {'id': 20, 'collections': [21], 'username': 'test', 'domain': 'archives-ouvertes.fr/', 'provider_url': 'https://hal-test.archives-ouvertes.fr/'}>
def test_post_deposit_atom_with_create_origin_and_reference(
authenticated_client, deposit_collection, atom_dataset, deposit_user
):
"""<swh:reference> and <swh:create_origin> are mutually exclusive
"""
external_id = "foobar"
origin_url = deposit_user.provider_url + external_id
url = reverse(COL_IRI, args=[deposit_collection.name])
document = atom_dataset["error-with-reference-and-create-origin"].format(
external_id=external_id, url=origin_url,
)
# when
response = authenticated_client.post(
url,
content_type="application/atom+xml;type=entry",
data=document,
# + headers
HTTP_IN_PROGRESS="false",
)
> assert b"only one may be used on a given deposit" in response.content
E assert b'only one may be used on a given deposit' in b'<?xml version="1.0" encoding="utf-8"?>\n<sword:error xmlns="http://www.w3.org/2005/Atom"\n xmlns:sword="... used in the same deposit.</summary>\n <sword:treatment>processing failed</sword:treatment>\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="... used in the same deposit.</summary>\n <sword:treatment>processing failed</sword:treatment>\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:255: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Nov 27 2020, 2:51 PM