Skip to content

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

Fix test

Krzysztof Świątekaef706710a29
diff --git a/saleor/graphql/discount/mutations.py b/saleor/graphql/discount/mutations.py
index 9275811f34..9ea3be8de3 100644
--- a/saleor/graphql/discount/mutations.py
+++ b/saleor/graphql/discount/mutations.py
@@ -270,10 +270,11 @@ class SaleUpdateMinimalVariantPriceMixin:
def success_response(cls, instance):
# Update the "minimal_variant_prices" of the associated, discounted
# products (including collections and categories).
- products_exists = instance.products.all().exists()
- categories_exists = instance.categories.all().exists()
- collections_exists = instance.collections.all().exists()
- if products_exists or categories_exists or collections_exists:
+ if (
+ instance.products.all()
+ or instance.categories.all()
+ or instance.collections.all()
+ ):
update_products_minimal_variant_prices_of_discount_task.delay(instance.pk)
return super().success_response(instance)
diff --git a/tests/api/test_product_minimal_variant_price.py b/tests/api/test_product_minimal_variant_price.py
index ee97ae6e8e..364ba170da 100644
--- a/tests/api/test_product_minimal_variant_price.py
+++ b/tests/api/test_product_minimal_variant_price.py
@@ -613,7 +613,7 @@ def test_sale_delete_updates_products_minimal_variant_prices(
content = get_graphql_content(response)
assert content["data"]["saleDelete"]["errors"] == []
- mock_update_minimal_variant_prices_task.delay.assert_called_once_with(sale.pk)
+ mock_update_minimal_variant_prices_task.delay.assert_not_called()
@patch(