Skip to content

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

Merge unique error codes

Aleksander Spyra00652b8ff4d3
diff --git a/saleor/graphql/core/utils/error_codes.py b/saleor/graphql/core/utils/error_codes.py
index e7b2758514..90c0a06238 100644
--- a/saleor/graphql/core/utils/error_codes.py
+++ b/saleor/graphql/core/utils/error_codes.py
@@ -122,7 +122,6 @@ class ProductErrorCode(Enum):
ATTRIBUTE_CANNOT_BE_ASSIGNED = "attribute_cannot_be_assigned"
ATTRIBUTE_DISABLED_VARIANTS = "attribute_disabled_variants"
ATTRIBUTE_NON_ASSIGNABLE = "attribute_non_assignable"
- ATTRIBUTE_VALUES_NOT_UNIQUE = "attribute_values_not_unique"
GRAPHQL_ERROR = "graphql_error"
INCORRECT_VALUE = "incorrect_value"
INVALID = "invalid"
diff --git a/saleor/graphql/product/mutations/attributes.py b/saleor/graphql/product/mutations/attributes.py
index 32f6d154eb..aeccabf3e6 100644
--- a/saleor/graphql/product/mutations/attributes.py
+++ b/saleor/graphql/product/mutations/attributes.py
@@ -130,8 +130,7 @@ class AttributeMixin:
raise ValidationError(
{
cls.ATTRIBUTE_VALUES_FIELD: ValidationError(
- "Provided values are not unique.",
- code=ProductErrorCode.ATTRIBUTE_VALUES_NOT_UNIQUE,
+ "Provided values are not unique.", code=ProductErrorCode.UNIQUE
)
}
)
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 64e6c55f86..538f5b1b0b 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -2903,7 +2903,6 @@ enum ProductErrorCode {
ATTRIBUTE_CANNOT_BE_ASSIGNED
ATTRIBUTE_DISABLED_VARIANTS
ATTRIBUTE_NON_ASSIGNABLE
- ATTRIBUTE_VALUES_NOT_UNIQUE
GRAPHQL_ERROR
INCORRECT_VALUE
INVALID
diff --git a/tests/api/test_attributes.py b/tests/api/test_attributes.py
index 0e2733b809..89764f58e5 100644
--- a/tests/api/test_attributes.py
+++ b/tests/api/test_attributes.py
@@ -480,13 +480,13 @@ def test_create_attribute_with_given_slug(
"Red color",
"Red color",
"Provided values are not unique.",
- ProductErrorCode.ATTRIBUTE_VALUES_NOT_UNIQUE,
+ ProductErrorCode.UNIQUE,
),
(
"Red color",
"red color",
"Provided values are not unique.",
- ProductErrorCode.ATTRIBUTE_VALUES_NOT_UNIQUE,
+ ProductErrorCode.UNIQUE,
),
),
)
@@ -628,13 +628,13 @@ def test_update_empty_attribute_and_add_values(
"Red color",
"Red color",
"Provided values are not unique.",
- ProductErrorCode.ATTRIBUTE_VALUES_NOT_UNIQUE,
+ ProductErrorCode.UNIQUE,
),
(
"Red color",
"red color",
"Provided values are not unique.",
- ProductErrorCode.ATTRIBUTE_VALUES_NOT_UNIQUE,
+ ProductErrorCode.UNIQUE,
),
),
)