swhid = 'swh:1:dir:c4993c872593e960dc84e4430dbbfbc34fd706d0;origin=https://inria.halpreprod.archives-ouvertes.fr/hal-01243573;visit=swh:1:snp:0175049fc45055a3824a1675ac06e3711619a55a;anchor=swh:1:rev:b5f505b005435fa5c4fa4c279792bd7b17167c04;path=/'
authenticated_client = <rest_framework.test.APIClient object at 0x7f021a819da0>
deposit_collection = <DepositCollection: {'id': 43, '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', ...}
swh_storage = <swh.storage.postgresql.storage.Storage object at 0x7f021ba7be10>
@pytest.mark.parametrize(
"swhid",
[
"swh:1:cnt:01b5c8cc985d190b5a7ef4878128ebfdc2358f49",
"swh:1:dir:11b5c8cc985d190b5a7ef4878128ebfdc2358f49",
"swh:1:rev:21b5c8cc985d190b5a7ef4878128ebfdc2358f49",
"swh:1:rel:31b5c8cc985d190b5a7ef4878128ebfdc2358f49",
"swh:1:snp:41b5c8cc985d190b5a7ef4878128ebfdc2358f49",
"swh:1:cnt:51b5c8cc985d190b5a7ef4878128ebfdc2358f49;origin=h://g.c/o/repo",
"swh:1:dir:c4993c872593e960dc84e4430dbbfbc34fd706d0;origin=https://inria.halpreprod.archives-ouvertes.fr/hal-01243573;visit=swh:1:snp:0175049fc45055a3824a1675ac06e3711619a55a;anchor=swh:1:rev:b5f505b005435fa5c4fa4c279792bd7b17167c04;path=/", # noqa
"swh:1:rev:71b5c8cc985d190b5a7ef4878128ebfdc2358f49;origin=h://g.c/o/repo",
"swh:1:rel:81b5c8cc985d190b5a7ef4878128ebfdc2358f49;origin=h://g.c/o/repo",
"swh:1:snp:91b5c8cc985d190b5a7ef4878128ebfdc2358f49;origin=h://g.c/o/repo",
],
)
def test_deposit_metadata_swhid(
swhid, authenticated_client, deposit_collection, atom_dataset, swh_storage,
):
"""Posting a swhid reference is stored on raw extrinsic metadata storage
"""
swhid_reference = QualifiedSWHID.from_string(swhid)
swhid_target = extended_swhid_from_qualified(swhid_reference)
xml_data = atom_dataset["entry-data-with-swhid"].format(swhid=swhid)
deposit_client = authenticated_client.deposit_client
_insert_object(swh_storage, swhid_reference)
response = post_atom(
authenticated_client,
reverse(COL_IRI, args=[deposit_collection.name]),
data=xml_data,
)
> assert response.status_code == status.HTTP_201_CREATED, 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 == 201
E +400
E -201
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_collection_post_atom.py:574: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 24 2022, 10:00 AM