Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add tests for getting order.availableShippingMEthods only from available warehouses for order channel
IKarbowiaka6062699b00a
diff --git a/saleor/graphql/order/tests/benchmark/test_order.py b/saleor/graphql/order/tests/benchmark/test_order.pyindex 051b21d62a..c45de91150 100644--- a/saleor/graphql/order/tests/benchmark/test_order.py+++ b/saleor/graphql/order/tests/benchmark/test_order.py@@ -18,10 +18,25 @@ FRAGMENT_DISCOUNTS = """}"""+FRAGMENT_AVAILABLE_SHIPPING_METHODS = """+ fragment AvailableShippingMethods on ShippingMethod {+ id+ price {+ amount+ }+ minimumOrderPrice {+ amount+ currency+ }+ type+ }+"""+FRAGMENT_ORDER_DETAILS = (FRAGMENT_ADDRESS+ FRAGMENT_PRODUCT_VARIANT+ FRAGMENT_DISCOUNTS+ + FRAGMENT_AVAILABLE_SHIPPING_METHODS+ """fragment OrderDetail on Order {userEmail@@ -48,6 +63,9 @@ FRAGMENT_ORDER_DETAILS = (...Price}}+ availableShippingMethods {+ ...AvailableShippingMethods+ }subtotal {...Price}diff --git a/saleor/graphql/order/tests/test_order.py b/saleor/graphql/order/tests/test_order.pyindex bbacca44dd..7660590e5f 100644--- a/saleor/graphql/order/tests/test_order.py+++ b/saleor/graphql/order/tests/test_order.py@@ -623,6 +623,35 @@ def test_order_available_shipping_methods_weight_method_with_higher_minimal_weigassert shipping_method.name not in shipping_methods+def test_order_query_shipping_zones_with_available_shipping_methods(+ staff_api_client,+ permission_manage_orders,+ fulfilled_order,+ shipping_zone,+):+ staff_api_client.user.user_permissions.add(permission_manage_orders)+ response = staff_api_client.post_graphql(ORDERS_QUERY_SHIPPING_METHODS)+ content = get_graphql_content(response)+ order_data = content["data"]["orders"]["edges"][0]["node"]+ assert len(order_data["availableShippingMethods"]) == 1+++def test_order_query_shipping_zones_without_channel(+ staff_api_client,+ permission_manage_orders,+ fulfilled_order,+ shipping_zone,+ channel_USD,+):+ channel_USD.shipping_zones.clear()+ staff_api_client.user.user_permissions.add(permission_manage_orders)+ response = staff_api_client.post_graphql(ORDERS_QUERY_SHIPPING_METHODS)+ content = get_graphql_content(response)+ order_data = content["data"]["orders"]["edges"][0]["node"]++ assert len(order_data["availableShippingMethods"]) == 0++def test_order_query_shipping_methods_excluded_postal_codes(staff_api_client,permission_manage_orders,