authenticated_client = <rest_framework.test.APIClient object at 0x7f8502bcaf98>
deposit_collection = <DepositCollection: {'id': 13, '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', ...}
sample_archive = {'data': b'PK\x03\x04\x14\x00\x00\x00\x00\x00\xb8FXT\xcba\xb4c\x14\x00\x00\x00\x14\x00\x00\x00\x05\x00\x00\x00file1som...ytest-0/test_add_deposit_add_to_wrong_0/tmp1493zbxg', 'length': 128, 'md5sum': 'f0a24bf4e6248c2f85e2f6a74766cee7', ...}
def test_add_deposit_add_to_wrong_origin(
authenticated_client, deposit_collection, atom_dataset, sample_archive,
):
"""Posting a deposit with an <swh:add_to_origin> referencing an origin
not starting with the provider_url raises an error
"""
origin_url = "http://example.org/foo"
# adding a new deposit with the same external id as a completed deposit
response = post_atom(
authenticated_client,
reverse(COL_IRI, args=[deposit_collection.name]),
data=atom_dataset["entry-data0"] % origin_url,
)
> assert response.status_code == status.HTTP_403_FORBIDDEN, response.content.decode()
E AssertionError: <?xml version="1.0" encoding="utf-8"?>
E <sword:error xmlns="http://www.w3.org/2005/Atom"
E xmlns:sword="http://purl.org/net/sword/terms/">
E <summary>Malformed xml metadata</summary>
E <sword:treatment>processing failed</sword:treatment>
E
E <sword:verboseDescription>
E The xml received is malformed. Please ensure your metadata file is correctly formatted.
E </sword:verboseDescription>
E
E </sword:error>
E
E assert 400 == 403
E +400
E -403
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_collection_add_to_origin.py:108: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 24 2022, 10:00 AM