diff --git a/docs/endpoints/content.rst b/docs/endpoints/content.rst
index 686ee20a..c69571ae 100644
--- a/docs/endpoints/content.rst
+++ b/docs/endpoints/content.rst
@@ -1,75 +1,49 @@
Display content
^^^^^^^^^^^^^^^^
.. http:get:: /1/(str:collection-name)/(int:deposit-id)/content/
Display information on the content's representation in the sword
server.
Also known as: CONT-FILE-IRI
**Example query**:
.. code:: http
GET /deposit/1/test/1/content/ HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Authorization: Basic xxxxxxxxxx
Connection: keep-alive
Host: deposit.softwareheritage.org
**Example response**:
.. code:: http
HTTP/1.1 200 OK
Allow: GET, POST, PUT, DELETE, HEAD, OPTIONS
Connection: keep-alive
Content-Length: 1760
Content-Type: application/xml
Date: Thu, 05 Nov 2020 14:31:50 GMT
Server: nginx/1.19.2
Vary: Accept
X-Frame-Options: SAMEORIGIN
1
done
The deposit has been successfully loaded into the Software Heritage archive
-
-
-
- Oct. 28, 2020, 3:58 p.m.
-
-
-
-
- test-01243065
- Verifiable online voting system
- {'name': 'Belenios', 'email': 'belenios@example.com'}
- test
- https://gitlab.inria.fr/belenios/belenios
- {'codemeta:name': 'Belenios Test User'}
- {'codemeta:name': 'GNU Affero General Public License'}
- 1.12
- Online voting
- test-01243065
- Verifiable online voting system
- opam
- stable
- test
- ocaml
-
-
- Oct. 28, 2020, 3:58 p.m.
-
+ Oct. 28, 2020, 3:58 p.m.
:reqheader Authorization: Basic authentication token
:statuscode 200: no error
:statuscode 401: Unauthorized
diff --git a/swh/deposit/templates/deposit/content.xml b/swh/deposit/templates/deposit/content.xml
index c1686efa..7cd6f152 100644
--- a/swh/deposit/templates/deposit/content.xml
+++ b/swh/deposit/templates/deposit/content.xml
@@ -1,16 +1,8 @@
{{ deposit_id }}
+ {{ request.date }}
{{ status }}
{{ status_detail }}
- {% for request in requests %}
-
- {% if request and request.metadata and request.metadata|length > 0 %}
-
- {% for k, v in request.metadata.items %}<{{ k }}>{{ v }}{{ k }}>
- {% endfor %}
- {% endif %}
- {{ request.date }}
- {% endfor %}
diff --git a/swh/deposit/tests/api/test_get_file.py b/swh/deposit/tests/api/test_get_file.py
index ed90a890..500cdccf 100644
--- a/swh/deposit/tests/api/test_get_file.py
+++ b/swh/deposit/tests/api/test_get_file.py
@@ -1,51 +1,51 @@
# Copyright (C) 2020 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
"""Tests 'GET File-IRI'."""
from django.urls import reverse
from rest_framework import status
from swh.deposit.config import CONT_FILE_IRI
from swh.deposit.models import DEPOSIT_STATUS_DETAIL
from swh.deposit.parsers import parse_xml
def test_api_deposit_content_nominal(
client, complete_deposit, partial_deposit_only_metadata
):
"""Retrieve information on deposit should return 200 response
"""
for deposit in [complete_deposit, partial_deposit_only_metadata]:
expected_deposit = {
"deposit_id": str(deposit.id),
"deposit_status": deposit.status,
"deposit_status_detail": DEPOSIT_STATUS_DETAIL[deposit.status],
}
url = reverse(CONT_FILE_IRI, args=[deposit.collection.name, deposit.id])
response = client.get(url)
assert response.status_code == status.HTTP_200_OK
actual_deposit = dict(parse_xml(response.content))
- expected_deposit["sword:request"] = actual_deposit["sword:request"]
+ del actual_deposit["deposit_date"]
assert actual_deposit == expected_deposit
def test_api_deposit_content_unknown(client, complete_deposit, deposit_collection):
"""Retrieve information on unknown deposit or collection should return 404
"""
unknown_deposit_id = 999
unknown_collection = "unknown"
for collection, deposit_id in [
(deposit_collection.name, unknown_deposit_id),
(unknown_collection, complete_deposit.id),
(complete_deposit.collection.name, complete_deposit.id + 10),
]:
url = reverse(CONT_FILE_IRI, args=[collection, deposit_id])
response = client.get(url)
assert response.status_code == status.HTTP_404_NOT_FOUND