Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7124315
D4059.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D4059.diff
View Options
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
@@ -689,44 +689,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,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Dec 21 2024, 6:23 AM (11 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219317
Attached To
D4059: deposit_update: Drop the unneeded check on the directory_missing call
Event Timeline
Log In to Comment