Page MenuHomeSoftware Heritage

D4069.diff
No OneTemporary

D4069.diff

diff --git a/swh/deposit/tests/api/test_deposit_binary.py b/swh/deposit/tests/api/test_deposit_binary.py
--- a/swh/deposit/tests/api/test_deposit_binary.py
+++ b/swh/deposit/tests/api/test_deposit_binary.py
@@ -155,6 +155,11 @@
# then
assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert (
+ b"The packaging provided something-unsupported is not supported"
+ in response.content
+ )
+
with pytest.raises(Deposit.DoesNotExist):
Deposit.objects.get(external_id=external_id)
@@ -185,6 +190,8 @@
# then
assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert b"CONTENT_DISPOSITION header is mandatory" in response.content
+
with pytest.raises(Deposit.DoesNotExist):
Deposit.objects.get(external_id=external_id)
@@ -481,6 +488,7 @@
)
assert r.status_code == status.HTTP_400_BAD_REQUEST
+ assert b"You can only act on deposit with status 'partial'" in r.content
# adding file is no longer possible since the deposit's status
# is ready
@@ -497,6 +505,7 @@
)
assert r.status_code == status.HTTP_400_BAD_REQUEST
+ assert b"You can only act on deposit with status 'partial'" in r.content
# replacing metadata is no longer possible since the deposit's
# status is ready
@@ -509,6 +518,7 @@
)
assert r.status_code == status.HTTP_400_BAD_REQUEST
+ assert b"You can only act on deposit with status 'partial'" in r.content
# adding new metadata is no longer possible since the
# deposit's status is ready
@@ -521,6 +531,7 @@
)
assert r.status_code == status.HTTP_400_BAD_REQUEST
+ assert b"You can only act on deposit with status 'partial'" in r.content
archive_content = b"some content representing archive"
archive = InMemoryUploadedFile(
@@ -550,6 +561,7 @@
)
assert r.status_code == status.HTTP_400_BAD_REQUEST
+ assert b"You can only act on deposit with status 'partial'" in r.content
# adding new metadata is no longer possible since the
# deposit's status is ready
@@ -560,3 +572,4 @@
)
assert r.status_code == status.HTTP_400_BAD_REQUEST
+ assert b"You can only act on deposit with status 'partial'" in r.content
diff --git a/swh/deposit/tests/api/test_deposit_delete.py b/swh/deposit/tests/api/test_deposit_delete.py
--- a/swh/deposit/tests/api/test_deposit_delete.py
+++ b/swh/deposit/tests/api/test_deposit_delete.py
@@ -81,6 +81,10 @@
response = authenticated_client.delete(update_uri)
# then
assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert (
+ b"You can only act on deposit with status 'partial'" in response.content
+ )
+
deposit = Deposit.objects.get(pk=deposit.id)
assert deposit is not None
@@ -119,5 +123,9 @@
response = authenticated_client.delete(url)
# then
assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert (
+ b"You can only act on deposit with status 'partial'" in response.content
+ )
+
deposit = Deposit.objects.get(pk=deposit.id)
assert deposit is not None
diff --git a/swh/deposit/tests/api/test_deposit_private_update_status.py b/swh/deposit/tests/api/test_deposit_private_update_status.py
--- a/swh/deposit/tests/api/test_deposit_private_update_status.py
+++ b/swh/deposit/tests/api/test_deposit_private_update_status.py
@@ -155,6 +155,7 @@
)
assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert b"Possible status in " in response.content
def test_update_deposit_status_will_fail_with_no_status_key(
@@ -172,6 +173,7 @@
)
assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert b"The status key is mandatory with possible values" in response.content
def test_update_deposit_status_success_without_swh_id_fail(
@@ -189,3 +191,6 @@
)
assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert (
+ b"Updating deposit status to done requires information" in response.content
+ )
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
@@ -10,6 +10,7 @@
from django.urls import reverse
from rest_framework import status
+from swh.deposit.api.common import ACCEPT_ARCHIVE_CONTENT_TYPES
from swh.deposit.config import (
DEPOSIT_STATUS_DEPOSITED,
DEPOSIT_STATUS_PARTIAL,
@@ -474,12 +475,9 @@
data=atom_dataset["entry-data1"],
)
assert response.status_code == status.HTTP_400_BAD_REQUEST
- response_content = parse_xml(response.content)
- msg = (
- "Packaging format supported is restricted to "
- + "application/zip, application/x-tar"
- )
- assert msg == response_content["sword:error"]["summary"]
+ assert b"Packaging format supported is restricted" in response.content
+ for supported_format in ACCEPT_ARCHIVE_CONTENT_TYPES:
+ assert supported_format.encode() in response.content
def test_put_metadata_to_em_iri_failure(
@@ -499,12 +497,9 @@
)
# then
assert response.status_code == status.HTTP_400_BAD_REQUEST
- response_content = parse_xml(response.content)
- msg = (
- "Packaging format supported is restricted to "
- + "application/zip, application/x-tar"
- )
- assert msg == response_content["sword:error"]["summary"]
+ assert b"Packaging format supported is restricted" in response.content
+ for supported_format in ACCEPT_ARCHIVE_CONTENT_TYPES:
+ assert supported_format.encode() in response.content
def test_put_update_metadata_and_archive_deposit_partial_nominal(

File Metadata

Mime Type
text/plain
Expires
Mar 17 2025, 6:28 PM (7 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3224102

Event Timeline