Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Cleanup test and api
Damian Wysocki33e1e5784107
diff --git a/saleor/graphql/core/enums.py b/saleor/graphql/core/enums.pyindex 1873dc86f8..5b568017cd 100644--- a/saleor/graphql/core/enums.py+++ b/saleor/graphql/core/enums.py@@ -6,12 +6,13 @@ from ...core import error_codes as core_error_codesfrom ...core.permissions import get_permissions_enum_listfrom ...core.weight import WeightUnitsfrom ...discount import error_codes as discount_error_codes-from ...plugins import error_codes as plugins_error_codes, TaxRateType as CoreTaxRateTypefrom ...giftcard import error_codes as giftcard_error_codesfrom ...menu import error_codes as menu_error_codesfrom ...order import error_codes as order_error_codesfrom ...page import error_codes as page_error_codesfrom ...payment import error_codes as payment_error_codes+from ...plugins import error_codes as plugins_error_codes+from ...plugins.vatlayer.plugin import TaxRateType as CoreTaxRateTypefrom ...product import error_codes as product_error_codesfrom ...shipping import error_codes as shipping_error_codesfrom ...warehouse import error_codes as warehouse_error_codes@@ -86,9 +87,7 @@ WeightUnitsEnum = graphene.Enum(AccountErrorCode = graphene.Enum.from_enum(account_error_codes.AccountErrorCode)CheckoutErrorCode = graphene.Enum.from_enum(checkout_error_codes.CheckoutErrorCode)DiscountErrorCode = graphene.Enum.from_enum(discount_error_codes.DiscountErrorCode)-PluginsErrorCode = graphene.Enum.from_enum(- plugins_error_codes.PluginsErrorCode-)+PluginsErrorCode = graphene.Enum.from_enum(plugins_error_codes.PluginsErrorCode)GiftCardErrorCode = graphene.Enum.from_enum(giftcard_error_codes.GiftCardErrorCode)MenuErrorCode = graphene.Enum.from_enum(menu_error_codes.MenuErrorCode)MetadataErrorCode = graphene.Enum.from_enum(core_error_codes.MetadataErrorCode)diff --git a/saleor/graphql/plugins/enums.py b/saleor/graphql/plugins/enums.pyindex eab67f71e6..f6b2510cae 100644--- a/saleor/graphql/plugins/enums.py+++ b/saleor/graphql/plugins/enums.py@@ -1,4 +1,4 @@-from ...plugins import ConfigurationTypeFieldfrom ...graphql.core.enums import to_enum+from ...plugins.base_plugin import ConfigurationTypeFieldConfigurationTypeFieldEnum = to_enum(ConfigurationTypeField)diff --git a/saleor/graphql/plugins/filters.py b/saleor/graphql/plugins/filters.pyindex f6eeba231e..36c57bba7f 100644--- a/saleor/graphql/plugins/filters.py+++ b/saleor/graphql/plugins/filters.py@@ -4,7 +4,7 @@ import grapheneif TYPE_CHECKING:# flake8: noqa- from ...plugins import BasePlugin+ from ...plugins.base_plugin import BasePlugindef filter_plugin_search(diff --git a/saleor/graphql/plugins/resolvers.py b/saleor/graphql/plugins/resolvers.pyindex 91ff97ff4f..86df92d43a 100644--- a/saleor/graphql/plugins/resolvers.py+++ b/saleor/graphql/plugins/resolvers.py@@ -1,4 +1,4 @@-from ...plugins import BasePlugin+from ...plugins.base_plugin import BasePluginfrom ...plugins.manager import get_plugins_managerfrom ...plugins.models import PluginConfigurationfrom .filters import filter_plugin_searchdiff --git a/saleor/graphql/plugins/sorters.py b/saleor/graphql/plugins/sorters.pyindex 66ba8bcb35..522494b2ad 100644--- a/saleor/graphql/plugins/sorters.py+++ b/saleor/graphql/plugins/sorters.py@@ -6,7 +6,7 @@ from ..core.types import SortInputObjectTypeif TYPE_CHECKING:# flake8: noqa- from ...plugins import BasePlugin+ from ...plugins.base_plugin import BasePlugindef sort_plugins(diff --git a/saleor/graphql/plugins/types.py b/saleor/graphql/plugins/types.pyindex 27be7781e6..ca79e7a544 100644--- a/saleor/graphql/plugins/types.py+++ b/saleor/graphql/plugins/types.py@@ -2,7 +2,8 @@ from typing import TYPE_CHECKING, Optionalimport graphene-from ...plugins import ConfigurationTypeField, manager, models+from ...plugins import manager, models+from ...plugins.base_plugin import ConfigurationTypeFieldfrom ..core.connection import CountableDjangoObjectTypefrom .enums import ConfigurationTypeFieldEnumdiff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 2fdd1ee4f1..5f6824d232 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -1625,21 +1625,6 @@ type Error {message: String}-type PluginsError {- field: String- message: String- code: PluginsErrorCode!-}--enum PluginsErrorCode {- GRAPHQL_ERROR- INVALID- PLUGIN_MISCONFIGURED- NOT_FOUND- REQUIRED- UNIQUE-}-type Fulfillment implements Node & ObjectWithMetadata {id: ID!fulfillmentOrder: Int!@@ -3133,6 +3118,21 @@ input PluginUpdateInput {configuration: [ConfigurationItemInput]}+type PluginsError {+ field: String+ message: String+ code: PluginsErrorCode!+}++enum PluginsErrorCode {+ GRAPHQL_ERROR+ INVALID+ PLUGIN_MISCONFIGURED+ NOT_FOUND+ REQUIRED+ UNIQUE+}+input PriceRangeInput {gte: Floatlte: Floatdiff --git a/saleor/payment/gateways/braintree/plugin.py b/saleor/payment/gateways/braintree/plugin.pyindex 2d56c248d5..d8a550b76e 100644--- a/saleor/payment/gateways/braintree/plugin.py+++ b/saleor/payment/gateways/braintree/plugin.py@@ -1,6 +1,6 @@from typing import TYPE_CHECKING, List-from saleor.plugins import ConfigurationTypeField, BasePlugin+from saleor.plugins.base_plugin import BasePlugin, ConfigurationTypeFieldfrom . import (GatewayConfig,diff --git a/saleor/payment/gateways/dummy/plugin.py b/saleor/payment/gateways/dummy/plugin.pyindex 3f7f2b1986..e60c77ad53 100644--- a/saleor/payment/gateways/dummy/plugin.py+++ b/saleor/payment/gateways/dummy/plugin.py@@ -1,6 +1,6 @@from typing import TYPE_CHECKING-from saleor.plugins import ConfigurationTypeField, BasePlugin+from saleor.plugins.base_plugin import BasePlugin, ConfigurationTypeFieldfrom . import (GatewayConfig,diff --git a/saleor/payment/gateways/razorpay/plugin.py b/saleor/payment/gateways/razorpay/plugin.pyindex a6a72367c8..919f0bd4a6 100644--- a/saleor/payment/gateways/razorpay/plugin.py+++ b/saleor/payment/gateways/razorpay/plugin.py@@ -1,6 +1,6 @@from typing import TYPE_CHECKING-from saleor.plugins import ConfigurationTypeField, BasePlugin+from saleor.plugins.base_plugin import BasePlugin, ConfigurationTypeFieldfrom . import GatewayConfig, capture, process_payment, refunddiff --git a/saleor/payment/gateways/stripe/plugin.py b/saleor/payment/gateways/stripe/plugin.pyindex 9777f25d5c..e90f1cedbc 100644--- a/saleor/payment/gateways/stripe/plugin.py+++ b/saleor/payment/gateways/stripe/plugin.py@@ -1,6 +1,6 @@from typing import TYPE_CHECKING, List-from saleor.plugins import ConfigurationTypeField, BasePlugin+from saleor.plugins.base_plugin import BasePlugin, ConfigurationTypeFieldfrom . import (GatewayConfig,diff --git a/saleor/plugins/__init__.py b/saleor/plugins/__init__.pyindex 46bc1d1e7e..d2990436ea 100644--- a/saleor/plugins/__init__.py+++ b/saleor/plugins/__init__.py@@ -3,12 +3,6 @@ from typing import Listfrom .checks import check_plugins # NOQA: F401-from .base_plugin import BasePlugin, ConfigurationTypeField-from .anonymize.plugin import AnonymizePlugin-from .avatax.plugin import AvataxPlugin-from .vatlayer.plugin import VatlayerPlugin-from .webhook.plugin import WebhookPlugin-def discover_plugins_modules(plugins: List[str]):plugins_modules = []diff --git a/saleor/plugins/webhook/__init__.py b/saleor/plugins/webhook/__init__.pyindex 1f7e83211b..2a1f6c97b7 100644--- a/saleor/plugins/webhook/__init__.py+++ b/saleor/plugins/webhook/__init__.py@@ -2,7 +2,7 @@ import hashlibimport hmacfrom typing import Optional-from ....site.models import Site+from ...site.models import Sitedef create_hmac_signature(body: str, secret_key: str, encoding: str):diff --git a/saleor/plugins/webhook/tasks.py b/saleor/plugins/webhook/tasks.pyindex 6b12f1b95a..db13ff71e5 100644--- a/saleor/plugins/webhook/tasks.py+++ b/saleor/plugins/webhook/tasks.py@@ -3,9 +3,9 @@ import loggingimport requestsfrom requests.exceptions import RequestException-from ....celeryconf import app-from ....webhook.event_types import WebhookEventType-from ....webhook.models import Webhook+from ...celeryconf import app+from ...webhook.event_types import WebhookEventType+from ...webhook.models import Webhookfrom . import create_webhook_headerslogger = logging.getLogger(__name__)diff --git a/tests/api/test_extensions.py b/tests/api/test_plugins.pysimilarity index 98%rename from tests/api/test_extensions.pyrename to tests/api/test_plugins.pyindex a4e3504b65..3df869092d 100644--- a/tests/api/test_extensions.py+++ b/tests/api/test_plugins.py@@ -1,7 +1,8 @@import copy+import pytest-from saleor.plugins import ConfigurationTypeField+from saleor.plugins.base_plugin import ConfigurationTypeFieldfrom saleor.plugins.error_codes import PluginsErrorCodefrom saleor.plugins.manager import get_plugins_managerfrom saleor.plugins.models import PluginConfiguration@@ -42,7 +43,7 @@ PLUGINS_QUERY = """def test_query_plugin_configurations(staff_api_client_can_manage_plugins, settings):# Enable test plugin- settings.PLUGINS = ["tests.api.plugins.PluginSample"]+ settings.PLUGINS = ["tests.plugins.sample_plugins.PluginSample"]response = staff_api_client_can_manage_plugins.post_graphql(PLUGINS_QUERY)content = get_graphql_content(response)@@ -96,7 +97,7 @@ def test_query_plugins_hides_secret_fields(settings,):- settings.PLUGINS = ["tests.api.plugins.PluginSample"]+ settings.PLUGINS = ["tests.plugins.sample_plugins.PluginSample"]manager = get_plugins_manager()plugin = manager.get_plugin(PluginSample.PLUGIN_NAME)configuration = copy.deepcopy(plugin.configuration)@@ -125,7 +126,7 @@ def test_query_plugins_hides_secret_fields(def test_query_plugin_configurations_as_customer_user(user_api_client, settings):- settings.PLUGINS = ["tests.api.plugins.PluginSample"]+ settings.PLUGINS = ["tests.plugins.sample_plugins.PluginSample"]response = user_api_client.post_graphql(PLUGINS_QUERY)assert_no_permission(response)diff --git a/tests/api/test_product.py b/tests/api/test_product.pyindex 4bac1bdbe4..51f0a5a516 100644--- a/tests/api/test_product.py+++ b/tests/api/test_product.py@@ -12,9 +12,9 @@ from graphql_relay import to_global_idfrom prices import Moneyfrom saleor.core.taxes import TaxType-from saleor.plugins.manager import PluginsManagerfrom saleor.graphql.core.enums import ReportingPeriodfrom saleor.graphql.product.utils import create_stocks+from saleor.plugins.manager import PluginsManagerfrom saleor.product import AttributeInputTypefrom saleor.product.error_codes import ProductErrorCodefrom saleor.product.models import (@@ -2097,7 +2097,7 @@ def test_product_type_create_mutation(staff_api_client, product_type, permission_manage_products, monkeypatch, settings):settings.VATLAYER_ACCESS_KEY = "test"- settings.PLUGINS = ["saleor.plugins.plugins.vatlayer.plugin.VatlayerPlugin"]+ settings.PLUGINS = ["saleor.plugins.vatlayer.plugin.VatlayerPlugin"]manager = PluginsManager(plugins=settings.PLUGINS)query = """mutation createProductType(diff --git a/tests/extensions/__init__.py b/tests/plugins/__init__.pysimilarity index 100%rename from tests/extensions/__init__.pyrename to tests/plugins/__init__.pydiff --git a/tests/extensions/conftest.py b/tests/plugins/conftest.pysimilarity index 88%rename from tests/extensions/conftest.pyrename to tests/plugins/conftest.pyindex d3970919cd..ce48d9a722 100644--- a/tests/extensions/conftest.py+++ b/tests/plugins/conftest.py@@ -1,8 +1,8 @@import pytest-from saleor.plugins import ConfigurationTypeField+from saleor.plugins.base_plugin import ConfigurationTypeFieldfrom saleor.plugins.models import PluginConfiguration-from tests.pliugins.sample_plugins import PluginInactive, PluginSample+from tests.plugins.sample_plugins import PluginInactive, PluginSample@pytest.fixturediff --git a/tests/extensions/plugins/__init__.py b/tests/plugins/plugins/__init__.pysimilarity index 100%rename from tests/extensions/plugins/__init__.pyrename to tests/plugins/plugins/__init__.pydiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_line_total[False-24.39-30.00-True].yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_line_total[False-24.39-30.00-True].yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_line_total[False-24.39-30.00-True].yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_line_total[False-24.39-30.00-True].yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_line_total[False-30.00-36.90-False].yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_line_total[False-30.00-36.90-False].yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_line_total[False-30.00-36.90-False].yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_line_total[False-30.00-36.90-False].yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_line_total[True-12.20-15.00-True].yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_line_total[True-12.20-15.00-True].yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_line_total[True-12.20-15.00-True].yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_line_total[True-12.20-15.00-True].yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_line_total[True-15.00-18.45-False].yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_line_total[True-15.00-18.45-False].yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_line_total[True-15.00-18.45-False].yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_line_total[True-15.00-18.45-False].yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_shipping.yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_shipping.yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_shipping.yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_shipping.yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_subtotal[False-40.65-50.00-True].yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_subtotal[False-40.65-50.00-True].yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_subtotal[False-40.65-50.00-True].yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_subtotal[False-40.65-50.00-True].yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_subtotal[False-50.00-61.50-False].yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_subtotal[False-50.00-61.50-False].yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_subtotal[False-50.00-61.50-False].yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_subtotal[False-50.00-61.50-False].yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_subtotal[True-20.33-25.00-True].yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_subtotal[True-20.33-25.00-True].yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_subtotal[True-20.33-25.00-True].yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_subtotal[True-20.33-25.00-True].yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_subtotal[True-25.00-30.75-False].yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_subtotal[True-25.00-30.75-False].yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_subtotal[True-25.00-30.75-False].yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_subtotal[True-25.00-30.75-False].yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_total[False-29.52-37.00-3.0-True].yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_total[False-29.52-37.00-3.0-True].yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_total[False-29.52-37.00-3.0-True].yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_total[False-29.52-37.00-3.0-True].yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_total[False-37.00-37.00-3.0-True].yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_total[False-37.00-37.00-3.0-True].yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_total[False-37.00-37.00-3.0-True].yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_total[False-37.00-37.00-3.0-True].yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_total[False-40.00-40.00-0.0-False].yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_total[False-40.00-40.00-0.0-False].yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_total[False-40.00-40.00-0.0-False].yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_total[False-40.00-40.00-0.0-False].yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_total[False-40.00-49.20-0.0-False].yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_total[False-40.00-49.20-0.0-False].yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_total[False-40.00-49.20-0.0-False].yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_total[False-40.00-49.20-0.0-False].yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_total[True-20.00-20.00-5.0-False].yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_total[True-20.00-20.00-5.0-False].yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_total[True-20.00-20.00-5.0-False].yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_total[True-20.00-20.00-5.0-False].yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_total[True-20.00-25.75-5.0-False].yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_total[True-20.00-25.75-5.0-False].yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_total[True-20.00-25.75-5.0-False].yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_total[True-20.00-25.75-5.0-False].yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_checkout_total[True-20.33-25.00-0.0-True].yaml b/tests/plugins/plugins/cassettes/test_calculate_checkout_total[True-20.33-25.00-0.0-True].yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_checkout_total[True-20.33-25.00-0.0-True].yamlrename to tests/plugins/plugins/cassettes/test_calculate_checkout_total[True-20.33-25.00-0.0-True].yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_order_line_unit.yaml b/tests/plugins/plugins/cassettes/test_calculate_order_line_unit.yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_order_line_unit.yamlrename to tests/plugins/plugins/cassettes/test_calculate_order_line_unit.yamldiff --git a/tests/extensions/plugins/cassettes/test_calculate_order_shipping.yaml b/tests/plugins/plugins/cassettes/test_calculate_order_shipping.yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_calculate_order_shipping.yamlrename to tests/plugins/plugins/cassettes/test_calculate_order_shipping.yamldiff --git a/tests/extensions/plugins/cassettes/test_get_cached_tax_codes_or_fetch.yaml b/tests/plugins/plugins/cassettes/test_get_cached_tax_codes_or_fetch.yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_get_cached_tax_codes_or_fetch.yamlrename to tests/plugins/plugins/cassettes/test_get_cached_tax_codes_or_fetch.yamldiff --git a/tests/extensions/plugins/cassettes/test_get_cached_tax_codes_or_fetch_wrong_response.yaml b/tests/plugins/plugins/cassettes/test_get_cached_tax_codes_or_fetch_wrong_response.yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_get_cached_tax_codes_or_fetch_wrong_response.yamlrename to tests/plugins/plugins/cassettes/test_get_cached_tax_codes_or_fetch_wrong_response.yamldiff --git a/tests/extensions/plugins/cassettes/test_plugin_uses_configuration_from_db.yaml b/tests/plugins/plugins/cassettes/test_plugin_uses_configuration_from_db.yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_plugin_uses_configuration_from_db.yamlrename to tests/plugins/plugins/cassettes/test_plugin_uses_configuration_from_db.yamldiff --git a/tests/extensions/plugins/cassettes/test_preprocess_order_creation.yaml b/tests/plugins/plugins/cassettes/test_preprocess_order_creation.yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_preprocess_order_creation.yamlrename to tests/plugins/plugins/cassettes/test_preprocess_order_creation.yamldiff --git a/tests/extensions/plugins/cassettes/test_preprocess_order_creation_wrong_data.yaml b/tests/plugins/plugins/cassettes/test_preprocess_order_creation_wrong_data.yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_preprocess_order_creation_wrong_data.yamlrename to tests/plugins/plugins/cassettes/test_preprocess_order_creation_wrong_data.yamldiff --git a/tests/extensions/plugins/cassettes/test_trigger_webhooks_for_event.yaml b/tests/plugins/plugins/cassettes/test_trigger_webhooks_for_event.yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_trigger_webhooks_for_event.yamlrename to tests/plugins/plugins/cassettes/test_trigger_webhooks_for_event.yamldiff --git a/tests/extensions/plugins/cassettes/test_trigger_webhooks_for_event_with_secret_key.yaml b/tests/plugins/plugins/cassettes/test_trigger_webhooks_for_event_with_secret_key.yamlsimilarity index 100%rename from tests/extensions/plugins/cassettes/test_trigger_webhooks_for_event_with_secret_key.yamlrename to tests/plugins/plugins/cassettes/test_trigger_webhooks_for_event_with_secret_key.yamldiff --git a/tests/extensions/plugins/conftest.py b/tests/plugins/plugins/conftest.pysimilarity index 100%rename from tests/extensions/plugins/conftest.pyrename to tests/plugins/plugins/conftest.pydiff --git a/tests/extensions/plugins/test_avatax.py b/tests/plugins/plugins/test_avatax.pysimilarity index 93%rename from tests/extensions/plugins/test_avatax.pyrename to tests/plugins/plugins/test_avatax.pyindex ff862ab8da..813511cf81 100644--- a/tests/extensions/plugins/test_avatax.py+++ b/tests/plugins/plugins/test_avatax.py@@ -6,15 +6,15 @@ from prices import Money, TaxedMoneyfrom saleor.checkout.utils import add_variant_to_checkoutfrom saleor.core.taxes import TaxError, quantize_price-from saleor.plugins.manager import get_plugins_manager-from saleor.plugins.models import PluginConfigurationfrom saleor.plugins.avatax import (AvataxConfiguration,checkout_needs_new_fetch,generate_request_data_from_checkout,get_cached_tax_codes_or_fetch,)-from saleor.plugins import AvataxPlugin+from saleor.plugins.avatax.plugin import AvataxPlugin+from saleor.plugins.manager import get_plugins_manager+from saleor.plugins.models import PluginConfiguration@pytest.fixture@@ -67,9 +67,7 @@ def test_calculate_checkout_line_total("saleor.plugins.avatax.plugin.get_cached_tax_codes_or_fetch",lambda _: {"PC040156": "desc"},)- manager = get_plugins_manager(- plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"]- )+ manager = get_plugins_manager(plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"])checkout_with_item.shipping_address = addresscheckout_with_item.shipping_method = shipping_zone.shipping_methods.get()@@ -119,9 +117,7 @@ def test_calculate_checkout_total("saleor.plugins.avatax.plugin.get_cached_tax_codes_or_fetch",lambda _: {"PC040156": "desc"},)- manager = get_plugins_manager(- plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"]- )+ manager = get_plugins_manager(plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"])checkout_with_item.shipping_address = addresscheckout_with_item.save()site_settings.company_address = address_usa@@ -160,9 +156,7 @@ def test_calculate_checkout_shipping("saleor.plugins.avatax.plugin.get_cached_tax_codes_or_fetch",lambda _: {"PC040156": "desc"},)- manager = get_plugins_manager(- plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"]- )+ manager = get_plugins_manager(plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"])site_settings.company_address = address_usasite_settings.save()@@ -209,9 +203,7 @@ def test_calculate_checkout_subtotal("saleor.plugins.avatax.plugin.get_cached_tax_codes_or_fetch",lambda _: {"PC040156": "desc"},)- manager = get_plugins_manager(- plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"]- )+ manager = get_plugins_manager(plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"])site_settings.company_address = address_usasite_settings.include_taxes_in_prices = taxes_in_pricessite_settings.save()@@ -234,9 +226,7 @@ def test_calculate_order_shipping(order_line, shipping_zone, site_settings, address_usa, plugin_configuration):plugin_configuration()- manager = get_plugins_manager(- plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"]- )+ manager = get_plugins_manager(plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"])order = order_line.ordermethod = shipping_zone.shipping_methods.get()order.shipping_address = order.billing_address.get_copy()@@ -257,9 +247,7 @@ def test_calculate_order_line_unit(order_line, shipping_zone, site_settings, address_usa, plugin_configuration,):plugin_configuration()- manager = get_plugins_manager(- plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"]- )+ manager = get_plugins_manager(plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"])order_line.unit_price = TaxedMoney(net=Money("10.00", "USD"), gross=Money("10.00", "USD"))@@ -300,9 +288,7 @@ def test_preprocess_order_creation("saleor.plugins.avatax.plugin.get_cached_tax_codes_or_fetch",lambda _: {"PC040156": "desc"},)- manager = get_plugins_manager(- plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"]- )+ manager = get_plugins_manager(plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"])site_settings.company_address = address_usasite_settings.save()@@ -328,9 +314,7 @@ def test_preprocess_order_creation_wrong_data("saleor.plugins.avatax.plugin.get_cached_tax_codes_or_fetch",lambda _: {"PC040156": "desc"},)- manager = get_plugins_manager(- plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"]- )+ manager = get_plugins_manager(plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"])checkout_with_item.shipping_address = addresscheckout_with_item.shipping_method = shipping_zone.shipping_methods.get()@@ -418,17 +402,12 @@ def test_show_taxes_on_storefront(plugin_configuration):def test_order_created(order, monkeypatch, plugin_configuration):plugin_configuration()- manager = get_plugins_manager(- plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"]- )+ manager = get_plugins_manager(plugins=["saleor.plugins.avatax.plugin.AvataxPlugin"])mocked_task = Mock()+ monkeypatch.setattr("saleor.plugins.avatax.plugin.get_order_tax_data", Mock())monkeypatch.setattr(- "saleor.plugins.avatax.plugin.get_order_tax_data", Mock()- )- monkeypatch.setattr(- "saleor.plugins.avatax.plugin.api_post_request_task.delay",- mocked_task,+ "saleor.plugins.avatax.plugin.api_post_request_task.delay", mocked_task,)manager.order_created(order)diff --git a/tests/extensions/plugins/test_plugins.py b/tests/plugins/plugins/test_plugins.pysimilarity index 94%rename from tests/extensions/plugins/test_plugins.pyrename to tests/plugins/plugins/test_plugins.pyindex 3844d62197..77049d20c9 100644--- a/tests/extensions/plugins/test_plugins.py+++ b/tests/plugins/plugins/test_plugins.py@@ -1,4 +1,5 @@-from saleor.plugins import ConfigurationTypeField, AnonymizePlugin+from saleor.plugins.anonymize.plugin import AnonymizePlugin+from saleor.plugins.base_plugin import ConfigurationTypeFieldfrom saleor.plugins.manager import get_plugins_managerfrom tests.plugins.sample_plugins import PluginSamplefrom tests.plugins.utils import get_config_value@@ -84,7 +85,7 @@ def test_base_plugin__append_config_structure_to_config(settings):def test_change_user_address_in_anonymize_plugin_reset_phone(address, settings):- settings.PLUGINS = ["saleor.plugins.plugins.anonymize.plugin.AnonymizePlugin"]+ settings.PLUGINS = ["saleor.plugins.anonymize.plugin.AnonymizePlugin"]manager = get_plugins_manager()anonymize_plugin = manager.get_plugin(AnonymizePlugin.PLUGIN_NAME)diff --git a/tests/extensions/plugins/test_vatlayer.py b/tests/plugins/plugins/test_vatlayer.pysimilarity index 98%rename from tests/extensions/plugins/test_vatlayer.pyrename to tests/plugins/plugins/test_vatlayer.pyindex 0013507d56..b89a81f170 100644--- a/tests/extensions/plugins/test_vatlayer.py+++ b/tests/plugins/plugins/test_vatlayer.py@@ -12,14 +12,14 @@ from saleor.checkout.utils import add_variant_to_checkoutfrom saleor.core.taxes import quantize_price, zero_taxed_moneyfrom saleor.plugins.manager import get_plugins_managerfrom saleor.plugins.models import PluginConfiguration-from saleor.plugins.plugins.vatlayer import (+from saleor.plugins.vatlayer import (DEFAULT_TAX_RATE_NAME,apply_tax_to_price,get_tax_rate_by_name,get_taxed_shipping_price,get_taxes_for_country,)-from saleor.plugins import VatlayerPlugin+from saleor.plugins.vatlayer.plugin import VatlayerPlugindef get_url_path(url):@@ -183,7 +183,7 @@ def test_apply_tax_to_price_no_taxes_raise_typeerror_for_invalid_type():def test_vatlayer_plugin_caches_taxes(vatlayer, monkeypatch, product, address):mocked_taxes = Mock(wraps=get_taxes_for_country)monkeypatch.setattr(- "saleor.plugins.plugins.vatlayer.plugin.get_taxes_for_country", mocked_taxes+ "saleor.plugins.vatlayer.plugin.get_taxes_for_country", mocked_taxes)manager = get_plugins_manager()@@ -386,8 +386,7 @@ def test_get_tax_rate_type_choices(vatlayer, settings, monkeypatch):"admission to entertainment events",]monkeypatch.setattr(- "saleor.plugins.vatlayer.plugin.get_tax_rate_types",- lambda: expected_choices,+ "saleor.plugins.vatlayer.plugin.get_tax_rate_types", lambda: expected_choices,)settings.PLUGINS = ["saleor.plugins.vatlayer.plugin.VatlayerPlugin"]manager = get_plugins_manager()diff --git a/tests/extensions/plugins/test_webhook.py b/tests/plugins/plugins/test_webhook.pysimilarity index 97%rename from tests/extensions/plugins/test_webhook.pyrename to tests/plugins/plugins/test_webhook.pyindex 60840ac2f4..65cf9b1f5d 100644--- a/tests/extensions/plugins/test_webhook.py+++ b/tests/plugins/plugins/test_webhook.py@@ -18,9 +18,7 @@ from saleor.webhook.payloads import (@pytest.mark.vcr- "saleor.plugins.webhook.tasks.requests.post", wraps=requests.post-)[email protected]("saleor.plugins.webhook.tasks.requests.post", wraps=requests.post)def test_trigger_webhooks_for_event(mock_request,webhook,@@ -110,9 +108,7 @@ def test_trigger_webhooks_for_event_calls_expected_events(@pytest.mark.vcr- "saleor.plugins.webhook.tasks.requests.post", wraps=requests.post-)[email protected]("saleor.plugins.webhook.tasks.requests.post", wraps=requests.post)def test_trigger_webhooks_for_event_with_secret_key(mock_request, webhook, order_with_lines, permission_manage_orders):diff --git a/tests/extensions/sample_plugins.py b/tests/plugins/sample_plugins.pysimilarity index 98%rename from tests/extensions/sample_plugins.pyrename to tests/plugins/sample_plugins.pyindex 8d3d91f8fe..c91472eb53 100644--- a/tests/extensions/sample_plugins.py+++ b/tests/plugins/sample_plugins.py@@ -5,7 +5,7 @@ from django_countries.fields import Countryfrom prices import Money, TaxedMoneyfrom saleor.core.taxes import TaxType-from saleor.plugins import ConfigurationTypeField, BasePlugin+from saleor.plugins.base_plugin import BasePlugin, ConfigurationTypeFieldfrom saleor.plugins.models import PluginConfigurationfrom saleor.product.models import Product, ProductTypediff --git a/tests/extensions/test_checks.py b/tests/plugins/test_checks.pysimilarity index 100%rename from tests/extensions/test_checks.pyrename to tests/plugins/test_checks.pydiff --git a/tests/extensions/test_manager.py b/tests/plugins/test_manager.pysimilarity index 94%rename from tests/extensions/test_manager.pyrename to tests/plugins/test_manager.pyindex 01acc8b154..88126022e4 100644--- a/tests/extensions/test_manager.py+++ b/tests/plugins/test_manager.py@@ -61,9 +61,9 @@ def test_manager_calculates_checkout_shipping():currency = checkout_with_item.currencyexpected_shipping_price = Money(shipping_amount, currency)- taxed_shipping_price = PluginsManager(- plugins=plugins- ).calculate_checkout_shipping(checkout_with_item, [discount_info])+ taxed_shipping_price = PluginsManager(plugins=plugins).calculate_checkout_shipping(+ checkout_with_item, [discount_info]+ )assert (TaxedMoney(expected_shipping_price, expected_shipping_price)== taxed_shipping_price@@ -105,14 +105,12 @@ def test_manager_calculates_checkout_line_total(@pytest.mark.parametrize("plugins, amount",- [(["tests.extenspluginsions.sample_plugins.PluginSample"], "1.0"), ([], "12.30")],+ [(["tests.plugins.sample_plugins.PluginSample"], "1.0"), ([], "12.30")],)def test_manager_calculates_order_line(order_line, plugins, amount):currency = order_line.unit_price.currencyexpected_price = Money(amount, currency)- unit_price = PluginsManager(plugins=plugins).calculate_order_line_unit(- order_line- )+ unit_price = PluginsManager(plugins=plugins).calculate_order_line_unit(order_line)assert expected_price == unit_price.gross@@ -127,9 +125,7 @@ def test_manager_calculates_order_line(order_line, plugins, amount):],)def test_manager_uses_get_tax_rate_choices(plugins, tax_rate_list):- assert (- tax_rate_list == {PluginsManager}(plugins=plugins).get_tax_rate_type_choices()- )+ assert tax_rate_list == PluginsManager(plugins=plugins).get_tax_rate_type_choices()@pytest.mark.parametrize(@@ -225,9 +221,7 @@ def test_plugin_updates_configuration_shape(plugin_configuration.configuration + [new_config],)- manager = PluginsManager(- plugins=["tests.plugins.sample_plugins.PluginSample"]- )+ manager = PluginsManager(plugins=["tests.plugins.sample_plugins.PluginSample"])plugin = manager.get_plugin("PluginSample")assert len(plugin.configuration) == 5@@ -243,9 +237,7 @@ def test_plugin_add_new_configuration()config_structure = {"Foo": new_config_structure}monkeypatch.setattr(PluginInactive, "CONFIG_STRUCTURE", config_structure)- manager = PluginsManager(- plugins=["tests.plugins.sample_plugins.PluginInactive"]- )+ manager = PluginsManager(plugins=["tests.plugins.sample_plugins.PluginInactive"])plugin = manager.get_plugin("PluginInactive")assert len(plugin.configuration) == 1assert plugin.configuration[0] == {**new_config, **new_config_structure}diff --git a/tests/extensions/utils.py b/tests/plugins/utils.pysimilarity index 100%rename from tests/extensions/utils.pyrename to tests/plugins/utils.py