diff --git a/swh/deposit/templates/deposit/content.xml b/swh/deposit/templates/deposit/content.xml --- a/swh/deposit/templates/deposit/content.xml +++ b/swh/deposit/templates/deposit/content.xml @@ -1,6 +1,15 @@ + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:sd="https://www.softwareheritage.org/schema/2018/deposit" + > + {{ deposit_id }} + {{ request.date }} + {{ status }} + {{ status_detail }} + + {{ deposit_id }} {{ request.date }} {{ status }} diff --git a/swh/deposit/templates/deposit/deposit_receipt.xml b/swh/deposit/templates/deposit/deposit_receipt.xml --- a/swh/deposit/templates/deposit/deposit_receipt.xml +++ b/swh/deposit/templates/deposit/deposit_receipt.xml @@ -1,6 +1,15 @@ + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:sd="https://www.softwareheritage.org/schema/2018/deposit" + > + {{ deposit_id }} + {{ deposit_date }} + {{ archive }} + {{ status }} + + {{ deposit_id }} {{ deposit_date }} {{ archive }} diff --git a/swh/deposit/templates/deposit/status.xml b/swh/deposit/templates/deposit/status.xml --- a/swh/deposit/templates/deposit/status.xml +++ b/swh/deposit/templates/deposit/status.xml @@ -1,9 +1,23 @@ + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:sd="https://www.softwareheritage.org/schema/2018/deposit" + > + {{ deposit_id }} + {{ status }} + {{ status_detail }} + + {% if swhid is not None %}{{ swhid }}{% endif %} + {% if swhid_context is not None %}{{ swhid_context }}{% endif %} + {% if external_id is not None %}{{ external_id }}{% endif %} + + + {{ deposit_id }} {{ status }} {{ status_detail }} + {% if swhid is not None %}{{ swhid }}{% endif %} {% if swhid_context is not None %}{{ swhid_context }}{% endif %} {% if external_id is not None %}{{ external_id }}{% endif %} diff --git a/swh/deposit/tests/api/test_collection.py b/swh/deposit/tests/api/test_collection.py --- a/swh/deposit/tests/api/test_collection.py +++ b/swh/deposit/tests/api/test_collection.py @@ -121,7 +121,7 @@ assert response.status_code == status.HTTP_201_CREATED response_content = parse_xml(BytesIO(response.content)) - deposit_id = response_content["deposit_id"] + deposit_id = response_content["swh:deposit_id"] assert deposit_id != deposit.id # new deposit @@ -151,7 +151,7 @@ assert response.status_code == status.HTTP_201_CREATED response_content = parse_xml(BytesIO(response.content)) - deposit_id = response_content["deposit_id"] + deposit_id = response_content["swh:deposit_id"] assert deposit_id != deposit.id @@ -182,7 +182,7 @@ assert response.status_code == status.HTTP_201_CREATED response_content = parse_xml(BytesIO(response.content)) - deposit_id = response_content["deposit_id"] + deposit_id = response_content["swh:deposit_id"] assert deposit_id != deposit.id diff --git a/swh/deposit/tests/api/test_collection_post_binary.py b/swh/deposit/tests/api/test_collection_post_binary.py --- a/swh/deposit/tests/api/test_collection_post_binary.py +++ b/swh/deposit/tests/api/test_collection_post_binary.py @@ -119,6 +119,12 @@ assert deposit_request.raw_metadata is None response_content = parse_xml(BytesIO(response.content)) + + assert response_content["swh:deposit_archive"] == sample_archive["name"] + assert int(response_content["swh:deposit_id"]) == deposit.id + assert response_content["swh:deposit_status"] == deposit.status + + # deprecated tags assert response_content["deposit_archive"] == sample_archive["name"] assert int(response_content["deposit_id"]) == deposit.id assert response_content["deposit_status"] == deposit.status diff --git a/swh/deposit/tests/api/test_deposit_private_check.py b/swh/deposit/tests/api/test_deposit_private_check.py --- a/swh/deposit/tests/api/test_deposit_private_check.py +++ b/swh/deposit/tests/api/test_deposit_private_check.py @@ -200,7 +200,7 @@ # then assert response.status_code == status.HTTP_201_CREATED response_content = parse_xml(response.content) - deposit_status = response_content["deposit_status"] + deposit_status = response_content["swh:deposit_status"] assert deposit_status == DEPOSIT_STATUS_DEPOSITED deposit_id = int(response_content["deposit_id"]) diff --git a/swh/deposit/tests/api/test_deposit_schedule.py b/swh/deposit/tests/api/test_deposit_schedule.py --- a/swh/deposit/tests/api/test_deposit_schedule.py +++ b/swh/deposit/tests/api/test_deposit_schedule.py @@ -57,7 +57,7 @@ assert response.status_code == status.HTTP_201_CREATED response_content = parse_xml(BytesIO(response.content)) - actual_state = response_content["deposit_status"] + actual_state = response_content["swh:deposit_status"] assert actual_state == DEPOSIT_STATUS_DEPOSITED deposit_id = response_content["deposit_id"] diff --git a/swh/deposit/tests/api/test_get_file.py b/swh/deposit/tests/api/test_get_file.py --- a/swh/deposit/tests/api/test_get_file.py +++ b/swh/deposit/tests/api/test_get_file.py @@ -31,8 +31,8 @@ response = client.get(url) assert response.status_code == status.HTTP_200_OK actual_deposit = dict(parse_xml(response.content)) - del actual_deposit["deposit_date"] - assert actual_deposit == expected_deposit + del actual_deposit["swh:deposit_date"] + assert set(actual_deposit.items()) >= set(expected_deposit.items()) def test_api_deposit_content_unknown(client, complete_deposit, deposit_collection): diff --git a/swh/deposit/tests/cli/test_client.py b/swh/deposit/tests/cli/test_client.py --- a/swh/deposit/tests/cli/test_client.py +++ b/swh/deposit/tests/cli/test_client.py @@ -607,7 +607,7 @@ with open(deposit_status_xml_path, "r") as f: deposit_status_xml = f.read() expected_deposit_status = dict(parse_xml(deposit_status_xml)) - assert expected_deposit_status["deposit_status"] != "done" + assert expected_deposit_status["swh:deposit_status"] != "done" # fmt: off result = cli_runner.invoke( diff --git a/swh/deposit/tests/data/https_deposit.swh.test/1_test b/swh/deposit/tests/data/https_deposit.swh.test/1_test --- a/swh/deposit/tests/data/https_deposit.swh.test/1_test +++ b/swh/deposit/tests/data/https_deposit.swh.test/1_test @@ -1,6 +1,14 @@ + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:sd="https://www.softwareheritage.org/schema/2018/deposit" + > + 615 + Oct. 8, 2020, 4:57 p.m. + None + partial + + 615 Oct. 8, 2020, 4:57 p.m. None diff --git a/swh/deposit/tests/data/https_deposit.test.metadata/1_test b/swh/deposit/tests/data/https_deposit.test.metadata/1_test --- a/swh/deposit/tests/data/https_deposit.test.metadata/1_test +++ b/swh/deposit/tests/data/https_deposit.test.metadata/1_test @@ -1,6 +1,14 @@ + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:sd="https://www.softwareheritage.org/schema/2018/deposit" + > + 666 + Oct. 8, 2020, 4:57 p.m. + hardcoded_sample_archive_path + partial + + 666 Oct. 8, 2020, 4:57 p.m. hardcoded_sample_archive_path diff --git a/swh/deposit/tests/data/https_deposit.test.metadata/1_test_666_metadata b/swh/deposit/tests/data/https_deposit.test.metadata/1_test_666_metadata --- a/swh/deposit/tests/data/https_deposit.test.metadata/1_test_666_metadata +++ b/swh/deposit/tests/data/https_deposit.test.metadata/1_test_666_metadata @@ -1,6 +1,13 @@ + xmlns:dcterms="http://purl.org/dc/terms/" + xmlns:sd="https://www.softwareheritage.org/schema/2018/deposit"> + 666 + Oct. 9, 2020, 8:44 p.m. + something + deposited + + 666 Oct. 9, 2020, 8:44 p.m. something