Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
fix shipping zone update mutation and test (#8859)
Jakub695297b7c74b
diff --git a/saleor/graphql/shipping/mutations/shippings.py b/saleor/graphql/shipping/mutations/shippings.pyindex afc46455bd..42388d64e8 100644--- a/saleor/graphql/shipping/mutations/shippings.py+++ b/saleor/graphql/shipping/mutations/shippings.py@@ -155,7 +155,7 @@ class ShippingZoneMixin:)else:countries = get_countries_without_shipping_zone()- data["countries"] = countries+ data["countries"].extend([country for country in countries])else:data["default"] = Falsereturn datadiff --git a/saleor/graphql/shipping/tests/test_shipping_method.py b/saleor/graphql/shipping/tests/test_shipping_method.pyindex 6edfdd4c25..ad51971293 100644--- a/saleor/graphql/shipping/tests/test_shipping_method.py+++ b/saleor/graphql/shipping/tests/test_shipping_method.py@@ -5,7 +5,6 @@ import pytestfrom ....shipping.error_codes import ShippingErrorCodefrom ....shipping.models import ShippingMethodChannelListing-from ....shipping.utils import get_countries_without_shipping_zonefrom ....tests.utils import dummy_editorjsfrom ...core.enums import WeightUnitsEnumfrom ...tests.utils import get_graphql_content@@ -125,10 +124,17 @@ def test_create_shipping_zone_without_warehouses_and_channels(assert zone["default"] is False+TEST_COUNTRIES_LIST = ["DZ", "AX", "BY"]+++@patch(+ "saleor.graphql.shipping.mutations.shippings.get_countries_without_shipping_zone",+ return_value=TEST_COUNTRIES_LIST,+)def test_create_default_shipping_zone(- staff_api_client, warehouse, permission_manage_shipping+ _, staff_api_client, warehouse, permission_manage_shipping):- unassigned_countries = set(get_countries_without_shipping_zone())+ unassigned_countries = TEST_COUNTRIES_LISTwarehouse_id = graphene.Node.to_global_id("Warehouse", warehouse.pk)variables = {"default": True,@@ -139,6 +145,7 @@ def test_create_default_shipping_zone(response = staff_api_client.post_graphql(CREATE_SHIPPING_ZONE_QUERY, variables, permissions=[permission_manage_shipping])+ expected_countries = set(unassigned_countries + variables["countries"])content = get_graphql_content(response)data = content["data"]["shippingZoneCreate"]assert not data["errors"]@@ -146,8 +153,8 @@ def test_create_default_shipping_zone(assert zone["name"] == "test shipping"assert zone["warehouses"][0]["name"] == warehouse.nameassert zone["default"] is True- zone_countries = {c.code for c in zone["countries"]}- assert zone_countries == unassigned_countries+ zone_countries = {c["code"] for c in zone["countries"]}+ assert zone_countries == expected_countriesdef test_create_duplicated_default_shipping_zone(