Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/api/test_deposit_atom.py
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | for atom_key in ["entry-data-empty-body", "entry-data-empty-body-no-namespace"]: | ||||
atom_content = atom_dataset[atom_key] | atom_content = atom_dataset[atom_key] | ||||
response = authenticated_client.post( | response = authenticated_client.post( | ||||
reverse(COL_IRI, args=[deposit_collection.name]), | reverse(COL_IRI, args=[deposit_collection.name]), | ||||
content_type="application/atom+xml;type=entry", | content_type="application/atom+xml;type=entry", | ||||
data=atom_content, | data=atom_content, | ||||
HTTP_SLUG="external-id", | HTTP_SLUG="external-id", | ||||
) | ) | ||||
assert response.status_code == status.HTTP_400_BAD_REQUEST | assert response.status_code == status.HTTP_400_BAD_REQUEST | ||||
assert b"Empty body request is not supported" in response.content | assert b"Mandatory alternate fields are missing" in response.content | ||||
def test_post_deposit_atom_400_badly_formatted_atom( | def test_post_deposit_atom_400_badly_formatted_atom( | ||||
authenticated_client, deposit_collection, atom_dataset | authenticated_client, deposit_collection, atom_dataset | ||||
): | ): | ||||
"""Posting a badly formatted atom should return a 400 response | """Posting a badly formatted atom should return a 400 response | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 246 Lines • Show Last 20 Lines |