authenticated_client = <rest_framework.test.APIClient object at 0x7f304a4ebb70>
deposit_collection = <DepositCollection: {'id': 26, 'name': 'test'}>
deposit_user = <DepositClient: {'id': 24, 'collections': [26], '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 0x7f3049f1cc18>
def test_post_deposit_atom_use_slug_header(
authenticated_client, deposit_collection, deposit_user, atom_dataset, mocker
):
"""Posting an atom entry with a slug header but no origin url generates
an origin url from the slug
"""
url = reverse(COL_IRI, args=[deposit_collection.name])
slug = str(uuid.uuid4())
# when
response = post_atom(
authenticated_client,
url,
data=atom_dataset["entry-data-no-origin-url"],
HTTP_IN_PROGRESS="false",
HTTP_SLUG=slug,
)
> 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:261: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 23 2022, 1:52 PM