Skip to content

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

Fix tests

Tomasz Szymanski753140cda172
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index e2ac230c82..1d6f3a043f 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -4433,6 +4433,7 @@ input OrderReturnProductsInput {
type OrderSettings {
automaticallyConfirmAllNewOrders: Boolean!
+ automaticallyFulfillNonShippableGiftCard: Boolean!
}
type OrderSettingsError {
diff --git a/saleor/graphql/shop/tests/test_shop.py b/saleor/graphql/shop/tests/test_shop.py
index 0e5ac2101d..b471f8ff4a 100644
--- a/saleor/graphql/shop/tests/test_shop.py
+++ b/saleor/graphql/shop/tests/test_shop.py
@@ -1203,7 +1203,7 @@ def test_staff_notification_update_mutation_with_empty_email(
ORDER_SETTINGS_UPDATE_MUTATION = """
- mutation orderSettings($confirmOrders: Boolean!) {
+ mutation orderSettings($confirmOrders: Boolean!, $fulfillGiftCards: Boolean!) {
orderSettingsUpdate(
input: {
automaticallyConfirmAllNewOrders: $confirmOrders
@@ -1234,6 +1234,7 @@ def test_order_settings_update_by_staff(
assert response_settings["automaticallyFulfillNonShippableGiftCard"] is False
site_settings.refresh_from_db()
assert site_settings.automatically_confirm_all_new_orders is False
+ assert site_settings.automatically_fulfill_non_shippable_gift_card is False
def test_order_settings_update_by_app(
@@ -1251,6 +1252,7 @@ def test_order_settings_update_by_app(
assert response_settings["automaticallyFulfillNonShippableGiftCard"] is False
site_settings.refresh_from_db()
assert site_settings.automatically_confirm_all_new_orders is False
+ assert site_settings.automatically_fulfill_non_shippable_gift_card is False
def test_order_settings_update_by_user_without_permissions(
@@ -1258,11 +1260,13 @@ def test_order_settings_update_by_user_without_permissions(
):
assert site_settings.automatically_confirm_all_new_orders is True
response = user_api_client.post_graphql(
- ORDER_SETTINGS_UPDATE_MUTATION, {"confirmOrders": False}
+ ORDER_SETTINGS_UPDATE_MUTATION,
+ {"confirmOrders": False, "fulfillGiftCards": False},
)
assert_no_permission(response)
site_settings.refresh_from_db()
assert site_settings.automatically_confirm_all_new_orders is True
+ assert site_settings.automatically_fulfill_non_shippable_gift_card is True
ORDER_SETTINGS_QUERY = """
@@ -1296,9 +1300,7 @@ def test_order_settings_query_as_staff(
assert content["data"]["orderSettings"]["automaticallyConfirmAllNewOrders"] is False
assert (
- content["data"]["orderSettings"][
- "automatically_fulfill_non_shippable_gift_card"
- ]
+ content["data"]["orderSettings"]["automaticallyFulfillNonShippableGiftCard"]
is False
)
diff --git a/saleor/graphql/shop/types.py b/saleor/graphql/shop/types.py
index 1f7350ce92..95912f8f26 100644
--- a/saleor/graphql/shop/types.py
+++ b/saleor/graphql/shop/types.py
@@ -47,7 +47,10 @@ class Domain(graphene.ObjectType):
class OrderSettings(CountableDjangoObjectType):
class Meta:
- only_fields = ["automatically_confirm_all_new_orders"]
+ only_fields = [
+ "automatically_confirm_all_new_orders",
+ "automatically_fulfill_non_shippable_gift_card",
+ ]
description = "Order related settings from site settings."
model = site_models.SiteSettings