authenticated_client = <rest_framework.test.APIClient object at 0x7f7cf849d438>
deposit_collection = <DepositCollection: {'id': 27, 'name': 'test'}>
deposit_user = <DepositClient: {'id': 25, 'collections': [27], 'username': 'test', 'domain': 'archives-ouvertes.fr/', 'provider_url': 'https://hal-test.archives-ouvertes.fr/'}>
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', ...}
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f7cf8b99630>
def test_post_deposit_atom_no_origin_url_nor_slug_header(
authenticated_client, deposit_collection, deposit_user, atom_dataset, mocker
):
"""Posting an atom entry without an origin url or a slug header should generate one
"""
url = reverse(COL_IRI, args=[deposit_collection.name])
slug = str(uuid.uuid4())
mocker.patch("uuid.uuid4", return_value=slug)
# when
response = post_atom(
authenticated_client,
url,
data=atom_dataset["entry-data-no-origin-url"],
HTTP_IN_PROGRESS="false",
)
> assert response.status_code == status.HTTP_201_CREATED
E assert 400 == 201
E +400
E -201
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_collection_post_atom.py:290: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 23 2022, 1:52 PM