diff --git a/docs/endpoints/content.rst b/docs/endpoints/content.rst
--- a/docs/endpoints/content.rst
+++ b/docs/endpoints/content.rst
@@ -57,7 +57,6 @@
{'codemeta:name': 'GNU Affero General Public License'}
1.12
Online voting
- test-01243065
Verifiable online voting system
opam
stable
diff --git a/docs/metadata.rst b/docs/metadata.rst
--- a/docs/metadata.rst
+++ b/docs/metadata.rst
@@ -38,11 +38,6 @@
www.url-example.com
-- **the external\_identifier** *MAY* be provided as an identifier
-
-- **the external\_identifier** *SHOULD* match the Slug external-identifier in
- the header
-
- **the description** of the software deposit *SHOULD* be provided
[codemeta:description]: short or long description of the software
@@ -63,7 +58,6 @@
Awesome Compiler
urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a
- 1785io25c695
2017-10-07T15:17:08Z
some awesome author
@@ -78,7 +72,6 @@
xmlns:codemeta="https://doi.org/10.5063/SCHEMA/CODEMETA-2.0">
Awesome Compiler
urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a
- 1785io25c695
1785io25c695
origin url
other identifier, DOI, ARK
@@ -140,7 +133,6 @@
Awesome Compiler
hal
urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a
- %s
hal-01587361
doi:10.5281/zenodo.438684
The assignment problem
diff --git a/docs/specs/metadata_example.xml b/docs/specs/metadata_example.xml
--- a/docs/specs/metadata_example.xml
+++ b/docs/specs/metadata_example.xml
@@ -7,7 +7,6 @@
hal@ccsd.cnrs.fr
hal
- hal-01243573
The assignment problem
https://hal.archives-ouvertes.fr/hal-01243573
other identifier, DOI, ARK
diff --git a/docs/specs/spec-meta-deposit.rst b/docs/specs/spec-meta-deposit.rst
--- a/docs/specs/spec-meta-deposit.rst
+++ b/docs/specs/spec-meta-deposit.rst
@@ -48,7 +48,6 @@
hal@ccsd.cnrs.fr
hal
- hal-01243573
The assignment problem
https://hal.archives-ouvertes.fr/hal-01243573
other identifier, DOI, ARK
diff --git a/docs/specs/spec-sparse-deposit.rst b/docs/specs/spec-sparse-deposit.rst
--- a/docs/specs/spec-sparse-deposit.rst
+++ b/docs/specs/spec-sparse-deposit.rst
@@ -44,7 +44,6 @@
hal@ccsd.cnrs.fr
hal
- hal-01243573
The assignment problem
https://hal.archives-ouvertes.fr/hal-01243573
other identifier, DOI, ARK
diff --git a/docs/user-manual.rst b/docs/user-manual.rst
--- a/docs/user-manual.rst
+++ b/docs/user-manual.rst
@@ -102,7 +102,6 @@
Verifiable online voting system
belenios
belenios-01243065
- test-01243065
https://gitlab.inria.fr/belenios/belenios
test
Online voting
diff --git a/swh/deposit/api/common.py b/swh/deposit/api/common.py
--- a/swh/deposit/api/common.py
+++ b/swh/deposit/api/common.py
@@ -211,7 +211,6 @@
"check-deposit",
collection=deposit.collection.name,
deposit_id=deposit.id,
- retries_left=3,
)
check_task_id = scheduler.create_tasks([task])[0]["id"]
deposit.check_task_id = check_task_id
@@ -662,7 +661,18 @@
"If the body is empty, there is no metadata.",
)
- external_id = metadata.get("external_identifier", headers["slug"])
+ external_id = headers["slug"]
+ if (
+ "external_identifier" in metadata
+ and metadata["external_identifier"] != external_id
+ ):
+ # TODO: When clients stopped using it, raise this error
+ # even when they are equal.
+ return make_error_dict(
+ BAD_REQUEST,
+ "The 'external_identifier' tag is deprecated, "
+ "the Slug header should be used instead.",
+ )
# TODO: Determine if we are in the metadata-only deposit case. If it is, then
# save deposit and deposit request typed 'metadata' and send metadata to the
@@ -898,7 +908,7 @@
class APIPost(APIBase, metaclass=ABCMeta):
- """Mixin for class to support POST method.
+ """Mixin for class to support DELETE method.
"""
diff --git a/swh/deposit/tests/api/test_deposit.py b/swh/deposit/tests/api/test_deposit.py
--- a/swh/deposit/tests/api/test_deposit.py
+++ b/swh/deposit/tests/api/test_deposit.py
@@ -115,7 +115,7 @@
response = authenticated_client.post(
reverse(COL_IRI, args=[deposit_collection.name]),
content_type="application/atom+xml;type=entry",
- data=atom_dataset["entry-data0"] % deposit.external_id,
+ data=atom_dataset["entry-data0"],
HTTP_SLUG=deposit.external_id,
)
@@ -145,7 +145,7 @@
response = authenticated_client.post(
reverse(COL_IRI, args=[deposit_collection.name]),
content_type="application/atom+xml;type=entry",
- data=atom_dataset["entry-data0"] % deposit.external_id,
+ data=atom_dataset["entry-data0"],
HTTP_SLUG=deposit.external_id,
)
@@ -176,7 +176,7 @@
response = authenticated_client.post(
reverse(COL_IRI, args=[deposit_collection.name]),
content_type="application/atom+xml;type=entry",
- data=atom_dataset["entry-data0"] % deposit.external_id,
+ data=atom_dataset["entry-data0"],
HTTP_SLUG=deposit.external_id,
)
diff --git a/swh/deposit/tests/api/test_deposit_atom.py b/swh/deposit/tests/api/test_deposit_atom.py
--- a/swh/deposit/tests/api/test_deposit_atom.py
+++ b/swh/deposit/tests/api/test_deposit_atom.py
@@ -115,6 +115,29 @@
assert response.status_code == status.HTTP_400_BAD_REQUEST
+def test_post_deposit_atom_with_external_identifier(
+ authenticated_client, deposit_collection, atom_dataset
+):
+ """Posting an atom entry without a slug header should return a 400
+
+ """
+ url = reverse(COL_IRI, args=[deposit_collection.name])
+
+ # when
+ response = authenticated_client.post(
+ url,
+ content_type="application/atom+xml;type=entry",
+ data=atom_dataset["error-with-external-identifier"],
+ # + headers
+ HTTP_IN_PROGRESS="false",
+ HTTP_SLUG="something",
+ )
+
+ print(response.content)
+ assert b"The 'external_identifier' tag is deprecated" in response.content
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+
+
def test_post_deposit_atom_unknown_collection(authenticated_client, atom_dataset):
"""Posting an atom entry to an unknown collection should return a 404
@@ -145,7 +168,7 @@
with pytest.raises(Deposit.DoesNotExist):
Deposit.objects.get(external_id=external_id)
- atom_entry_data = atom_dataset["entry-data0"] % external_id
+ atom_entry_data = atom_dataset["entry-data0"]
# when
response = authenticated_client.post(
@@ -186,7 +209,7 @@
with pytest.raises(Deposit.DoesNotExist):
Deposit.objects.get(external_id=external_id)
- atom_entry_data = atom_dataset["codemeta-sample"] % external_id
+ atom_entry_data = atom_dataset["codemeta-sample"]
# when
response = authenticated_client.post(
reverse(COL_IRI, args=[deposit_collection.name]),
@@ -291,9 +314,7 @@
deposit_requests = DepositRequest.objects.filter(deposit=deposit)
assert len(deposit_requests) == 1
- atom_entry_data = atom_dataset["entry-data-minimal"] % external_id.encode(
- "utf-8"
- ) # noqa
+ atom_entry_data = atom_dataset["entry-data-minimal"]
update_uri = response._headers["location"][1]
@@ -306,7 +327,7 @@
)
# then
- assert response.status_code == status.HTTP_201_CREATED
+ assert response.status_code == status.HTTP_201_CREATED, response.content
response_content = parse_xml(BytesIO(response.content))
deposit_id = int(response_content["deposit_id"])
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
@@ -110,7 +110,7 @@
"""
# given
deposit = partial_deposit_with_metadata
- raw_metadata0 = atom_dataset["entry-data0"] % deposit.external_id.encode("utf-8")
+ raw_metadata0 = atom_dataset["entry-data0"]
requests_meta = DepositRequest.objects.filter(deposit=deposit, type="metadata")
assert len(requests_meta) == 1
@@ -235,9 +235,7 @@
)
assert len(requests) == 2
- expected_raw_meta0 = atom_dataset["entry-data0"] % (
- deposit.external_id.encode("utf-8")
- )
+ expected_raw_meta0 = atom_dataset["entry-data0"]
# a new one was added
assert requests[0].raw_metadata == expected_raw_meta0
assert requests[1].raw_metadata == atom_entry
@@ -300,9 +298,7 @@
)
assert len(requests) == 1 + 1, "New deposit request archive got added"
- expected_raw_meta0 = atom_dataset["entry-data0"] % (
- deposit.external_id.encode("utf-8")
- )
+ expected_raw_meta0 = atom_dataset["entry-data0"]
# a new one was added
assert requests[0].raw_metadata == expected_raw_meta0
assert requests[1].raw_metadata == data_atom_entry
@@ -517,7 +513,7 @@
"""
# given
deposit = partial_deposit_with_metadata
- raw_metadata0 = atom_dataset["entry-data0"] % deposit.external_id.encode("utf-8")
+ raw_metadata0 = atom_dataset["entry-data0"]
requests_meta = DepositRequest.objects.filter(deposit=deposit, type="metadata")
assert len(requests_meta) == 1
diff --git a/swh/deposit/tests/conftest.py b/swh/deposit/tests/conftest.py
--- a/swh/deposit/tests/conftest.py
+++ b/swh/deposit/tests/conftest.py
@@ -313,7 +313,7 @@
response = authenticated_client.post(
reverse(EDIT_SE_IRI, args=[collection_name, deposit.id]),
content_type="application/atom+xml;type=entry",
- data=atom_dataset["entry-data0"] % deposit.external_id.encode("utf-8"),
+ data=atom_dataset["entry-data0"],
HTTP_SLUG=deposit.external_id,
HTTP_IN_PROGRESS="true",
)
diff --git a/swh/deposit/tests/data/atom/codemeta-sample.xml b/swh/deposit/tests/data/atom/codemeta-sample.xml
--- a/swh/deposit/tests/data/atom/codemeta-sample.xml
+++ b/swh/deposit/tests/data/atom/codemeta-sample.xml
@@ -2,7 +2,6 @@
- %s
hal-01587361
https://hal.inria.fr/hal-01587361
https://hal.inria.fr/hal-01587361/document
diff --git a/swh/deposit/tests/data/atom/entry-data-minimal.xml b/swh/deposit/tests/data/atom/entry-data-minimal.xml
--- a/swh/deposit/tests/data/atom/entry-data-minimal.xml
+++ b/swh/deposit/tests/data/atom/entry-data-minimal.xml
@@ -1,4 +1,4 @@
- %s
+ Awesome Compiler
diff --git a/swh/deposit/tests/data/atom/entry-data0.xml b/swh/deposit/tests/data/atom/entry-data0.xml
--- a/swh/deposit/tests/data/atom/entry-data0.xml
+++ b/swh/deposit/tests/data/atom/entry-data0.xml
@@ -3,7 +3,6 @@
Awesome Compiler
hal
urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a
- %s
2017-10-07T15:17:08Z
some awesome author
something
diff --git a/swh/deposit/tests/data/atom/entry-data2.xml b/swh/deposit/tests/data/atom/entry-data2.xml
--- a/swh/deposit/tests/data/atom/entry-data2.xml
+++ b/swh/deposit/tests/data/atom/entry-data2.xml
@@ -1,6 +1,5 @@
- some-external-id
https://hal-test.archives-ouvertes.fr/some-external-id
some awesome author
diff --git a/swh/deposit/tests/data/atom/error-with-decimal.xml b/swh/deposit/tests/data/atom/error-with-decimal.xml
--- a/swh/deposit/tests/data/atom/error-with-decimal.xml
+++ b/swh/deposit/tests/data/atom/error-with-decimal.xml
@@ -3,7 +3,6 @@
Composing a Web of Audio Applications
hal
hal-01243065
- hal-01243065
https://hal-test.archives-ouvertes.fr/hal-01243065
test
diff --git a/swh/deposit/tests/data/atom/error-with-external-identifier.xml b/swh/deposit/tests/data/atom/error-with-external-identifier.xml
new file mode 100644
--- /dev/null
+++ b/swh/deposit/tests/data/atom/error-with-external-identifier.xml
@@ -0,0 +1,7 @@
+
+
+ Composing a Web of Audio Applications
+ hal
+ hal-01243065
+ hal-01243065
+
diff --git a/swh/deposit/tests/data/atom/metadata.xml b/swh/deposit/tests/data/atom/metadata.xml
--- a/swh/deposit/tests/data/atom/metadata.xml
+++ b/swh/deposit/tests/data/atom/metadata.xml
@@ -4,7 +4,6 @@
Composing a Web of Audio Applications
hal
hal-01243065
- hal-01243065
https://hal-test.archives-ouvertes.fr/hal-01243065
test
DSP programming