diff --git a/assets/src/bundles/save/artifact-form-row.ejs b/assets/src/bundles/save/artifact-form-row.ejs
new file mode 100644
--- /dev/null
+++ b/assets/src/bundles/save/artifact-form-row.ejs
@@ -0,0 +1,34 @@
+<%#
+ Copyright (C) 2021 The Software Heritage developers
+ See the AUTHORS file at the top-level directory of this distribution
+ License: GNU Affero General Public License version 3, or any later version
+ See top-level LICENSE file for more information
+%>
+
+
diff --git a/swh/web/tests/api/views/test_origin_save.py b/swh/web/tests/api/views/test_origin_save.py
--- a/swh/web/tests/api/views/test_origin_save.py
+++ b/swh/web/tests/api/views/test_origin_save.py
@@ -507,7 +507,6 @@
},
]
- # then
url = reverse(
"api-1-save-origin",
url_args={"visit_type": "archives", "origin_url": originUrl,},
@@ -517,7 +516,11 @@
api_client,
url,
status_code=200,
- data={"artifact_url": artifact_url, "artifact_version": artifact_version,},
+ data={
+ "archives_data": [
+ {"artifact_url": artifact_url, "artifact_version": artifact_version,}
+ ]
+ },
)
assert response.data["save_request_status"] == SAVE_REQUEST_ACCEPTED
@@ -525,6 +528,33 @@
assert SaveAuthorizedOrigin.objects.get(url=originUrl)
+def test_create_save_request_archives_missing_artifacts_data(
+ api_client, origin_to_review, keycloak_oidc, mocker, requests_mock,
+):
+
+ keycloak_oidc.realm_permissions = [SWH_AMBASSADOR_PERMISSION]
+ oidc_profile = keycloak_oidc.login()
+ api_client.credentials(HTTP_AUTHORIZATION=f"Bearer {oidc_profile['refresh_token']}")
+
+ originUrl = "https://somewhere.org/simple"
+
+ url = reverse(
+ "api-1-save-origin",
+ url_args={"visit_type": "archives", "origin_url": originUrl,},
+ )
+
+ response = check_api_post_response(api_client, url, status_code=400, data={},)
+ assert "Artifacts data are missing" in response.data["reason"]
+
+ response = check_api_post_response(
+ api_client,
+ url,
+ status_code=400,
+ data={"archives_data": [{"artifact_url": "", "arttifact_version": "1.0"}]},
+ )
+ assert "Missing url or version for an artifact to load" in response.data["reason"]
+
+
def test_create_save_request_archives_accepted_ambassador_user(
api_client, origin_to_review, keycloak_oidc, mocker
):
diff --git a/swh/web/tests/common/test_origin_save.py b/swh/web/tests/common/test_origin_save.py
--- a/swh/web/tests/common/test_origin_save.py
+++ b/swh/web/tests/common/test_origin_save.py
@@ -360,12 +360,6 @@
_check_origin_exists(url_ko)
-@pytest.mark.parametrize("invalid_origin", [None, ""])
-def test__check_origin_invalid_input(invalid_origin):
- with pytest.raises(BadInputExc, match="must be set"):
- _check_origin_exists(invalid_origin)
-
-
def test__check_origin_exists_200(requests_mock):
url = "https://example.org/url"
requests_mock.head(url, status_code=200)