authenticated_client = <rest_framework.test.APIClient object at 0x7fb007d134e0>
deposit_collection = <DepositCollection: {'id': 15, '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': 14, 'collections': [15], 'username': 'test', 'domain': 'archives-ouvertes.fr/', 'provider_url': 'https://hal-test.archives-ouvertes.fr/'}>
def test_post_deposit_atom_403_add_to_wrong_origin_url_prefix(
authenticated_client, deposit_collection, atom_dataset, deposit_user
):
"""Creating an origin for a prefix not owned by the client is forbidden
"""
origin_url = "http://example.org/foo"
response = post_atom(
authenticated_client,
reverse(COL_IRI, args=[deposit_collection.name]),
data=atom_dataset["entry-data-with-add-to-origin"] % origin_url,
HTTP_IN_PROGRESS="true",
)
> assert response.status_code == status.HTTP_403_FORBIDDEN
E assert 400 == 403
E +400
E -403
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_collection_add_to_origin.py:152: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 23 2022, 3:56 PM