diff --git a/swh/deposit/api/deposit_update.py b/swh/deposit/api/deposit_update.py --- a/swh/deposit/api/deposit_update.py +++ b/swh/deposit/api/deposit_update.py @@ -11,7 +11,6 @@ from swh.deposit.api.checks import check_metadata from swh.deposit.api.converters import convert_status_detail from swh.deposit.models import Deposit -from swh.model.hashutil import hash_to_bytes from swh.model.identifiers import parse_swhid from swh.model.model import ( MetadataAuthority, @@ -253,20 +252,6 @@ deposit_swhid = parse_swhid(swhid) - directory_id = hash_to_bytes(deposit_swhid.object_id) - - # check the swhid exists in the archive - directories_missing = list( - self.storage_metadata.directory_missing([directory_id]) - ) - if len(directories_missing) > 0: - return make_error_dict( - BAD_REQUEST, - f"Unknown directory SWHID {swhid} reference", - "The SWHID provided is not a known directory SWHID in SWH archive. " - "Please provide an existing SWHID.", - ) - # replace metadata within the deposit backend deposit_request_data = { METADATA_KEY: metadata, diff --git a/swh/deposit/tests/api/test_deposit_update.py b/swh/deposit/tests/api/test_deposit_update.py --- a/swh/deposit/tests/api/test_deposit_update.py +++ b/swh/deposit/tests/api/test_deposit_update.py @@ -688,44 +688,6 @@ ) -def test_put_update_metadata_done_deposit_failure_swhid_unknown( - tmp_path, - authenticated_client, - complete_deposit, - deposit_collection, - atom_dataset, - swh_storage, -): - """Failure: client updates metadata with a SWHID matching the deposit's. Said SWHID does - not exist in the archive somehow. - - This should not happen though, it is still technically possible so it's - covered... - - Response: 400 - - """ - # directory targeted by the complete_deposit does not exist in the storage - missing_directory_id = hash_to_bytes(parse_swhid(complete_deposit.swh_id).object_id) - assert list(swh_storage.directory_missing([missing_directory_id])) == [ - missing_directory_id - ] - - update_uri = reverse( - EDIT_SE_IRI, args=[deposit_collection.name, complete_deposit.id] - ) - - response = authenticated_client.put( - update_uri, - content_type="application/atom+xml;type=entry", - data=atom_dataset["entry-data1"], - HTTP_X_CHECK_SWHID=complete_deposit.swh_id, - ) - - assert response.status_code == status.HTTP_400_BAD_REQUEST - assert b"Unknown directory SWHID" in response.content - - def test_put_update_metadata_done_deposit_failure_mismatched_swhid( tmp_path, authenticated_client,