Skip to content

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

Update resolver for address validation rules

IKarbowiak2fd61b7119aa
diff --git a/saleor/graphql/account/resolvers.py b/saleor/graphql/account/resolvers.py
index fbbe721277..46a2d149d9 100644
--- a/saleor/graphql/account/resolvers.py
+++ b/saleor/graphql/account/resolvers.py
@@ -99,7 +99,7 @@ def resolve_address_validation_rules(
],
city_type=rules.city_type,
city_choices=[ChoiceValue(area[0], area[1]) for area in rules.city_choices],
- city_area_type=rules.city_type,
+ city_area_type=rules.city_area_type,
city_area_choices=[
ChoiceValue(area[0], area[1]) for area in rules.city_area_choices
],
diff --git a/saleor/graphql/account/tests/test_account.py b/saleor/graphql/account/tests/test_account.py
index 315838de0f..834f3db7e2 100644
--- a/saleor/graphql/account/tests/test_account.py
+++ b/saleor/graphql/account/tests/test_account.py
@@ -3433,6 +3433,8 @@ def test_address_validation_rules(user_api_client):
addressFormat
addressLatinFormat
postalCodeMatchers
+ cityType
+ cityAreaType
}
}
"""
@@ -3444,6 +3446,8 @@ def test_address_validation_rules(user_api_client):
assert data["countryName"] == "POLAND"
assert data["addressFormat"] is not None
assert data["addressLatinFormat"] is not None
+ assert data["cityType"] == "city"
+ assert data["cityAreaType"] == "suburb"
matcher = data["postalCodeMatchers"][0]
matcher = re.compile(matcher)
assert matcher.match("00-123")
@@ -3491,7 +3495,7 @@ def test_address_validation_rules_with_country_area(user_api_client):
assert data["countryAreaChoices"]
assert data["cityType"] == "city"
assert data["cityChoices"]
- assert data["cityAreaType"] == "city"
+ assert data["cityAreaType"] == "district"
assert not data["cityAreaChoices"]