Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Drop unused site clear cache (#18954)
Iga Karbowiak758df7555b55
diff --git a/saleor/graphql/account/tests/benchmark/test_account.py b/saleor/graphql/account/tests/benchmark/test_account.pyindex 6c26ad6d56..b7439dbd81 100644--- a/saleor/graphql/account/tests/benchmark/test_account.py+++ b/saleor/graphql/account/tests/benchmark/test_account.py@@ -5,7 +5,6 @@ import pytestfrom django.core.files import Filefrom .....account.models import Group, User-from .....site.models import Sitefrom ....tests.utils import get_graphql_content@@ -413,10 +412,6 @@ def test_users_for_federation_query_count(content = get_graphql_content(response)assert len(content["data"]["_entities"]) == 2- # Clear cache for proper query count comparison.- # Site and site settings are cached in `auth_backend` when querying the current site.- Site.objects.clear_cache()-variables = {"representations": [{@@ -496,10 +491,6 @@ def test_addresses_for_federation_query_count(content = get_graphql_content(response)assert len(content["data"]["_entities"]) == 1- # Clear cache for proper query count comparison.- # Site and site settings are cached in `auth_backend` when querying the current site.- Site.objects.clear_cache()-variables = {"representations": [{diff --git a/saleor/graphql/app/tests/benchmarks/test_apps.py b/saleor/graphql/app/tests/benchmarks/test_apps.pyindex 38211b2727..64a3c9dd2c 100644--- a/saleor/graphql/app/tests/benchmarks/test_apps.py+++ b/saleor/graphql/app/tests/benchmarks/test_apps.py@@ -2,7 +2,6 @@ import grapheneimport pytestfrom .....app.models import App, AppToken-from .....site.models import Sitefrom .....webhook.models import Webhookfrom ....tests.utils import get_graphql_content@@ -55,10 +54,6 @@ def test_apps_for_federation_query_count(content = get_graphql_content(response)assert len(content["data"]["_entities"]) == 1- # Clear cache for proper query count comparison.- # Site and site settings are cached in `auth_backend` when querying the current site.- Site.objects.clear_cache()-variables = {"representations": [{diff --git a/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py b/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.pyindex c56fdce2c7..7e6646485f 100644--- a/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py+++ b/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py@@ -17,7 +17,6 @@ from .....plugins.manager import get_plugins_managerfrom .....product.models import Product, ProductVariant, ProductVariantChannelListingfrom .....product.utils.variant_prices import update_discounted_prices_for_promotionfrom .....product.utils.variants import fetch_variants_for_promotion_rules-from .....site.models import Sitefrom .....warehouse.models import Stockfrom ....core.utils import to_global_id_or_nonefrom ....tests.utils import get_graphql_content@@ -839,10 +838,6 @@ def test_update_checkout_lines_with_reservations(data = content["data"]["checkoutLinesUpdate"]assert not data["errors"]- # Clear cache for proper query count comparison.- # Site and site settings are cached in `auth_backend` when querying the current site.- Site.objects.clear_cache()-# Updating multiple lines in checkout has same query count as updating onewith django_assert_num_queries(107):variables = {@@ -1115,10 +1110,6 @@ def test_add_checkout_lines_with_reservations(data = content["data"]["checkoutLinesAdd"]assert not data["errors"]- # Clear cache for proper query count comparison.- # Site and site settings are cached in `auth_backend` when querying the current site.- Site.objects.clear_cache()-checkout.lines.exclude(id=line.id).delete()with django_assert_num_queries(104):diff --git a/saleor/graphql/discount/tests/benchmark/test_voucher_code_bulk_delete.py b/saleor/graphql/discount/tests/benchmark/test_voucher_code_bulk_delete.pyindex 883750e686..29c49150ec 100644--- a/saleor/graphql/discount/tests/benchmark/test_voucher_code_bulk_delete.py+++ b/saleor/graphql/discount/tests/benchmark/test_voucher_code_bulk_delete.py@@ -1,7 +1,6 @@import grapheneimport pytest-from .....site.models import Sitefrom ....tests.utils import get_graphql_contentVOUCHER_CODE_BULK_DELETE_MUTATION = """@@ -38,10 +37,6 @@ def test_voucher_code_bulk_delete_queries(content = get_graphql_content(response)assert content["data"]["voucherCodeBulkDelete"]["count"] == 1- # Clear cache for proper query count comparison.- # Site and site settings are cached in `auth_backend` when querying the current site.- Site.objects.clear_cache()-variables = {"ids": ids[1:]}with django_assert_num_queries(11):diff --git a/saleor/graphql/product/tests/benchmark/test_product.py b/saleor/graphql/product/tests/benchmark/test_product.pyindex 8f15301b76..34a2dbf4d4 100644--- a/saleor/graphql/product/tests/benchmark/test_product.py+++ b/saleor/graphql/product/tests/benchmark/test_product.py@@ -13,7 +13,6 @@ from .....channel.models import Channelfrom .....core.taxes import TaxTypefrom .....plugins.manager import PluginsManagerfrom .....product.models import ProductChannelListing, ProductMedia, ProductTranslation-from .....site.models import Sitefrom ....tests.utils import get_graphql_content@@ -334,10 +333,6 @@ def test_retrieve_channel_listings())- # Clear cache for proper query count comparison.- # Site and site settings are cached in `auth_backend` when querying the current site.- Site.objects.clear_cache()-ProductChannelListing.objects.bulk_create([ProductChannelListing(diff --git a/saleor/graphql/warehouse/tests/benchmark/test_stock_bulk_update.py b/saleor/graphql/warehouse/tests/benchmark/test_stock_bulk_update.pyindex 2c7253d3cb..3d32b5cee3 100644--- a/saleor/graphql/warehouse/tests/benchmark/test_stock_bulk_update.py+++ b/saleor/graphql/warehouse/tests/benchmark/test_stock_bulk_update.py@@ -1,7 +1,6 @@import pytestfrom django.db import connection-from .....site.models import Sitefrom .....warehouse.models import Stockfrom ....tests.utils import get_graphql_content@@ -90,10 +89,6 @@ def test_stocks_bulk_update_queries_count()assert webhook_queries_count == 1- # Clear cache for proper query count comparison.- # Site and site settings are cached in `auth_backend` when querying the current site.- Site.objects.clear_cache()-stocks_input += [{"variantExternalReference": variant_1.external_reference,diff --git a/saleor/tests/e2e/account/account/test_staff_login_customers_only_mode.py b/saleor/tests/e2e/account/account/test_staff_login_customers_only_mode.pyindex f67c976893..1363d60559 100644--- a/saleor/tests/e2e/account/account/test_staff_login_customers_only_mode.py+++ b/saleor/tests/e2e/account/account/test_staff_login_customers_only_mode.py@@ -1,7 +1,6 @@from unittest.mock import patchimport pytest-from django.contrib.sites.models import Sitefrom .....site import PasswordLoginModefrom ...account.utils.token_create import raw_token_create@@ -80,7 +79,6 @@ def test_staff_token_has_no_permissions_in_customers_only_mode(# Step 3: Switch to CUSTOMERS_ONLY modesite_settings.password_login_mode = PasswordLoginMode.CUSTOMERS_ONLYsite_settings.save(update_fields=["password_login_mode"])- Site.objects.clear_cache()# Step 4: Try to create a product and fetch orders — should failresponse = enabled_client.post_graphql(PRODUCT_CREATE_MUTATION, product_input)@@ -96,7 +94,6 @@ def test_staff_token_has_no_permissions_in_customers_only_mode(# Step 5: Switch back to ENABLED mode — should succeed againsite_settings.password_login_mode = PasswordLoginMode.ENABLEDsite_settings.save(update_fields=["password_login_mode"])- Site.objects.clear_cache()response = enabled_client.post_graphql(PRODUCT_CREATE_MUTATION, product_input)content = get_graphql_content(response)diff --git a/saleor/tests/e2e/account/account/test_staff_login_disabled_mode.py b/saleor/tests/e2e/account/account/test_staff_login_disabled_mode.pyindex 4b9eae415b..32708b2c83 100644--- a/saleor/tests/e2e/account/account/test_staff_login_disabled_mode.py+++ b/saleor/tests/e2e/account/account/test_staff_login_disabled_mode.py@@ -1,7 +1,6 @@from unittest.mock import patchimport pytest-from django.contrib.sites.models import Sitefrom .....site import PasswordLoginModefrom ...account.utils.token_create import raw_token_create@@ -80,7 +79,6 @@ def test_staff_token_is_rejected_in_disabled_mode(# Step 3: Switch to DISABLED modesite_settings.password_login_mode = PasswordLoginMode.DISABLEDsite_settings.save(update_fields=["password_login_mode"])- Site.objects.clear_cache()# Step 4: Try to create a product and fetch orders — should fail (user is not authenticated)response = enabled_client.post_graphql(PRODUCT_CREATE_MUTATION, product_input)@@ -100,7 +98,6 @@ def test_staff_token_is_rejected_in_disabled_mode(# Step 5: Switch back to ENABLED mode — should succeed againsite_settings.password_login_mode = PasswordLoginMode.ENABLEDsite_settings.save(update_fields=["password_login_mode"])- Site.objects.clear_cache()response = enabled_client.post_graphql(PRODUCT_CREATE_MUTATION, product_input)content = get_graphql_content(response)