Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/api/test_deposit_atom.py
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
): | ): | ||||
"""Posting empty body request should return a 400 response | """Posting empty body request should return a 400 response | ||||
""" | """ | ||||
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_dataset["entry-data-empty-body"], | data=atom_dataset["entry-data-empty-body"], | ||||
HTTP_SLUG="something", | |||||
) | ) | ||||
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 | |||||
ardumont: That test was green for the wrong reason...
When debugging that test because i did not… | |||||
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 260 Lines • Show Last 20 Lines |
That test was green for the wrong reason...
When debugging that test because i did not understand something, i saw the 400 failure was about the missing slug, not because of the empty body request.
I needed to have another equivalent test for the new endpoint.
So I fixed it here nonetheless.
@vlorentz tl; dr; that test failed without the .xml change you asked about.