Skip to content

Saleor Core: the high performance, composable, headless commerce API.

[main] Use UNIQUE error when installing app with the same identifier (#18339)

Jonatan Witoszekc31fb4cfd08f
diff --git a/saleor/app/manifest_validations.py b/saleor/app/manifest_validations.py
index 5fd8f2ddc4..c67f7ec14b 100644
--- a/saleor/app/manifest_validations.py
+++ b/saleor/app/manifest_validations.py
@@ -192,7 +192,8 @@ def clean_manifest_data(manifest_data, raise_for_saleor_version=False):
):
errors["identifier"].append(
ValidationError(
- f"App with the same identifier is already installed: {app.name}"
+ f"App with the same identifier is already installed: {app.name}",
+ code=AppErrorCode.UNIQUE.value,
)
)
if not errors:
diff --git a/saleor/graphql/app/tests/mutations/test_app_fetch_manifest.py b/saleor/graphql/app/tests/mutations/test_app_fetch_manifest.py
index 14f0bde758..d015109f95 100644
--- a/saleor/graphql/app/tests/mutations/test_app_fetch_manifest.py
+++ b/saleor/graphql/app/tests/mutations/test_app_fetch_manifest.py
@@ -887,7 +887,7 @@ def test_fetch_manifest_fail_when_app_with_same_identifier_already_installed(
# then
assert len(errors) == 1
assert errors[0]["field"] == "identifier"
- assert errors[0]["code"] == "INVALID"
+ assert errors[0]["code"] == AppErrorCode.UNIQUE.name
assert errors[0]["message"] == (
f"App with the same identifier is already installed: {app.name}"
)