url = 'https://gitlab.org/user/repo'
authenticated_client = <rest_framework.test.APIClient object at 0x7f3048a884e0>
deposit_collection = <DepositCollection: {'id': 47, '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 0x7f3048e69a58>
@pytest.mark.parametrize(
"url", ["https://gitlab.org/user/repo", "https://whatever.else/repo",]
)
def test_deposit_metadata_origin(
url, authenticated_client, deposit_collection, atom_dataset, swh_storage,
):
"""Posting a swhid reference is stored on raw extrinsic metadata storage
"""
xml_data = atom_dataset["entry-data-with-origin-reference"].format(url=url)
origin_swhid = Origin(url).swhid()
deposit_client = authenticated_client.deposit_client
swh_storage.origin_add([Origin(url)])
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:652: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 23 2022, 1:52 PM