authenticated_client = <rest_framework.test.APIClient object at 0x7f60c3982fd0>
deposit_collection = <DepositCollection: {'id': 88, 'name': 'test'}>
partial_deposit_with_metadata = <Deposit: {'id': 75, 'reception_date': datetime.datetime(2020, 9, 25, 13, 19, 8, 634721, tzinfo=<UTC>), 'collection': 'test', 'external_id': 'external-id-partial', 'client': 'test', 'status': 'partial'}>
atom_dataset = {'codemeta-sample': '<?xml version="1.0"?>\n <entry xmlns="http://www.w3.org/2005/Atom"\n xmlns:d...erms:type>Type</dcterms:type>\n\n</entry>\n', 'entry-data-empty-body': '<?xml version="1.0"?>\n<entry></entry>\n', ...}
def test_post_metadata_empty_post_refused_without_in_progress_false(
authenticated_client,
deposit_collection,
partial_deposit_with_metadata,
atom_dataset,
):
"""Empty atom post entry without header in-progress to false is bad a request
Response: 200
"""
deposit = partial_deposit_with_metadata
assert deposit.status == DEPOSIT_STATUS_PARTIAL
requests = DepositRequest.objects.filter(deposit=deposit, type="metadata")
assert len(requests) == 1
requests_archive0 = DepositRequest.objects.filter(deposit=deposit, type="archive")
assert len(requests_archive0) == 1
update_uri = reverse(EDIT_SE_IRI, args=[deposit_collection.name, deposit.id])
response = authenticated_client.post(
update_uri, content_type="application/atom+xml;type=entry", data="" # empty
)
> assert response.status_code == status.HTTP_400_BAD_REQUEST
E assert 200 == 400
E +200
E -400
.tox/py3/lib/python3.7/site-packages/swh/deposit/tests/api/test_deposit_update.py:649: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Sep 25 2020, 3:19 PM