authenticated_client = <rest_framework.test.APIClient object at 0x7f7cf83ecf98>
deposit_collection = <DepositCollection: {'id': 33, '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': 31, 'collections': [33], 'username': 'test', 'domain': 'archives-ouvertes.fr/', 'provider_url': 'https://hal-test.archives-ouvertes.fr/'}>
def test_post_deposit_atom_entry_initial(
authenticated_client, deposit_collection, atom_dataset, deposit_user
):
"""Posting an initial atom entry should return 201 with deposit receipt
"""
# given
origin_url = deposit_user.provider_url + "1225c695-cfb8-4ebb-aaaa-80da344efa6a"
with pytest.raises(Deposit.DoesNotExist):
Deposit.objects.get(origin_url=origin_url)
atom_entry_data = atom_dataset["entry-data0"] % origin_url
# when
response = post_atom(
authenticated_client,
reverse(COL_IRI, args=[deposit_collection.name]),
data=atom_entry_data,
HTTP_IN_PROGRESS="false",
)
# then
> 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:444: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 23 2022, 1:52 PM