Skip to content

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

Move plugin tests

fowczrekae77c912557c
diff --git a/conftest.py b/conftest.py
index 75305858c3..262b94e4bf 100644
--- a/conftest.py
+++ b/conftest.py
@@ -1 +1 @@
-pytest_plugins = "tests.fixtures"
+pytest_plugins = ["tests.fixtures", "saleor.plugins.tests.fixtures"]
diff --git a/saleor/plugins/avatax/tests/__init__.py b/saleor/plugins/avatax/tests/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/plugins/cassettes/test_calculate_checkout_line_total[False-24.39-30.00-True].yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_line_total[False-24.39-30.00-True].yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_line_total[False-24.39-30.00-True].yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_line_total[False-24.39-30.00-True].yaml
diff --git a/tests/plugins/cassettes/test_calculate_checkout_line_total[False-30.00-36.90-False].yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_line_total[False-30.00-36.90-False].yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_line_total[False-30.00-36.90-False].yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_line_total[False-30.00-36.90-False].yaml
diff --git a/tests/plugins/cassettes/test_calculate_checkout_line_total[True-12.20-15.00-True].yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_line_total[True-12.20-15.00-True].yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_line_total[True-12.20-15.00-True].yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_line_total[True-12.20-15.00-True].yaml
diff --git a/tests/plugins/cassettes/test_calculate_checkout_line_total[True-15.00-18.45-False].yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_line_total[True-15.00-18.45-False].yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_line_total[True-15.00-18.45-False].yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_line_total[True-15.00-18.45-False].yaml
diff --git a/tests/plugins/cassettes/test_calculate_checkout_shipping.yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_shipping.yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_shipping.yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_shipping.yaml
diff --git a/tests/plugins/cassettes/test_calculate_checkout_subtotal[False-40.65-50.00-True].yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_subtotal[False-40.65-50.00-True].yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_subtotal[False-40.65-50.00-True].yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_subtotal[False-40.65-50.00-True].yaml
diff --git a/tests/plugins/cassettes/test_calculate_checkout_subtotal[False-50.00-61.50-False].yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_subtotal[False-50.00-61.50-False].yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_subtotal[False-50.00-61.50-False].yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_subtotal[False-50.00-61.50-False].yaml
diff --git a/tests/plugins/cassettes/test_calculate_checkout_subtotal[True-20.33-25.00-True].yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_subtotal[True-20.33-25.00-True].yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_subtotal[True-20.33-25.00-True].yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_subtotal[True-20.33-25.00-True].yaml
diff --git a/tests/plugins/cassettes/test_calculate_checkout_subtotal[True-25.00-30.75-False].yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_subtotal[True-25.00-30.75-False].yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_subtotal[True-25.00-30.75-False].yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_subtotal[True-25.00-30.75-False].yaml
diff --git a/tests/plugins/cassettes/test_calculate_checkout_total[False-29.52-37.00-3.0-True].yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_total[False-29.52-37.00-3.0-True].yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_total[False-29.52-37.00-3.0-True].yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_total[False-29.52-37.00-3.0-True].yaml
diff --git a/tests/plugins/cassettes/test_calculate_checkout_total[False-37.00-37.00-3.0-True].yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_total[False-37.00-37.00-3.0-True].yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_total[False-37.00-37.00-3.0-True].yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_total[False-37.00-37.00-3.0-True].yaml
diff --git a/tests/plugins/cassettes/test_calculate_checkout_total[False-40.00-40.00-0.0-False].yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_total[False-40.00-40.00-0.0-False].yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_total[False-40.00-40.00-0.0-False].yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_total[False-40.00-40.00-0.0-False].yaml
diff --git a/tests/plugins/cassettes/test_calculate_checkout_total[False-40.00-49.20-0.0-False].yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_total[False-40.00-49.20-0.0-False].yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_total[False-40.00-49.20-0.0-False].yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_total[False-40.00-49.20-0.0-False].yaml
diff --git a/tests/plugins/cassettes/test_calculate_checkout_total[True-20.00-20.00-5.0-False].yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_total[True-20.00-20.00-5.0-False].yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_total[True-20.00-20.00-5.0-False].yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_total[True-20.00-20.00-5.0-False].yaml
diff --git a/tests/plugins/cassettes/test_calculate_checkout_total[True-20.00-25.75-5.0-False].yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_total[True-20.00-25.75-5.0-False].yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_total[True-20.00-25.75-5.0-False].yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_total[True-20.00-25.75-5.0-False].yaml
diff --git a/tests/plugins/cassettes/test_calculate_checkout_total[True-20.33-25.00-0.0-True].yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_total[True-20.33-25.00-0.0-True].yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_checkout_total[True-20.33-25.00-0.0-True].yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_checkout_total[True-20.33-25.00-0.0-True].yaml
diff --git a/tests/plugins/cassettes/test_calculate_order_line_unit.yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_order_line_unit.yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_order_line_unit.yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_order_line_unit.yaml
diff --git a/tests/plugins/cassettes/test_calculate_order_shipping.yaml b/saleor/plugins/avatax/tests/cassettes/test_calculate_order_shipping.yaml
similarity index 100%
rename from tests/plugins/cassettes/test_calculate_order_shipping.yaml
rename to saleor/plugins/avatax/tests/cassettes/test_calculate_order_shipping.yaml
diff --git a/tests/plugins/cassettes/test_get_cached_tax_codes_or_fetch.yaml b/saleor/plugins/avatax/tests/cassettes/test_get_cached_tax_codes_or_fetch.yaml
similarity index 100%
rename from tests/plugins/cassettes/test_get_cached_tax_codes_or_fetch.yaml
rename to saleor/plugins/avatax/tests/cassettes/test_get_cached_tax_codes_or_fetch.yaml
diff --git a/tests/plugins/cassettes/test_get_cached_tax_codes_or_fetch_wrong_response.yaml b/saleor/plugins/avatax/tests/cassettes/test_get_cached_tax_codes_or_fetch_wrong_response.yaml
similarity index 100%
rename from tests/plugins/cassettes/test_get_cached_tax_codes_or_fetch_wrong_response.yaml
rename to saleor/plugins/avatax/tests/cassettes/test_get_cached_tax_codes_or_fetch_wrong_response.yaml
diff --git a/tests/plugins/cassettes/test_plugin_uses_configuration_from_db.yaml b/saleor/plugins/avatax/tests/cassettes/test_plugin_uses_configuration_from_db.yaml
similarity index 100%
rename from tests/plugins/cassettes/test_plugin_uses_configuration_from_db.yaml
rename to saleor/plugins/avatax/tests/cassettes/test_plugin_uses_configuration_from_db.yaml
diff --git a/tests/plugins/cassettes/test_preprocess_order_creation.yaml b/saleor/plugins/avatax/tests/cassettes/test_preprocess_order_creation.yaml
similarity index 100%
rename from tests/plugins/cassettes/test_preprocess_order_creation.yaml
rename to saleor/plugins/avatax/tests/cassettes/test_preprocess_order_creation.yaml
diff --git a/tests/plugins/cassettes/test_preprocess_order_creation_wrong_data.yaml b/saleor/plugins/avatax/tests/cassettes/test_preprocess_order_creation_wrong_data.yaml
similarity index 100%
rename from tests/plugins/cassettes/test_preprocess_order_creation_wrong_data.yaml
rename to saleor/plugins/avatax/tests/cassettes/test_preprocess_order_creation_wrong_data.yaml
diff --git a/tests/plugins/test_avatax.py b/saleor/plugins/avatax/tests/test_avatax.py
similarity index 100%
rename from tests/plugins/test_avatax.py
rename to saleor/plugins/avatax/tests/test_avatax.py
diff --git a/saleor/plugins/tests/__init__.py b/saleor/plugins/tests/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/plugins/conftest.py b/saleor/plugins/tests/fixtures.py
similarity index 97%
rename from tests/plugins/conftest.py
rename to saleor/plugins/tests/fixtures.py
index b1457bcda2..1ac98ce406 100644
--- a/tests/plugins/conftest.py
+++ b/saleor/plugins/tests/fixtures.py
@@ -4,7 +4,7 @@ from django_prices_vatlayer.utils import get_tax_for_rate
from saleor.plugins.base_plugin import ConfigurationTypeField
from saleor.plugins.models import PluginConfiguration
-from tests.plugins.sample_plugins import PluginInactive, PluginSample
+from saleor.plugins.tests.sample_plugins import PluginInactive, PluginSample
@pytest.fixture
diff --git a/tests/plugins/sample_plugins.py b/saleor/plugins/tests/sample_plugins.py
similarity index 100%
rename from tests/plugins/sample_plugins.py
rename to saleor/plugins/tests/sample_plugins.py
diff --git a/tests/plugins/test_checks.py b/saleor/plugins/tests/test_checks.py
similarity index 100%
rename from tests/plugins/test_checks.py
rename to saleor/plugins/tests/test_checks.py
diff --git a/tests/plugins/test_manager.py b/saleor/plugins/tests/test_manager.py
similarity index 81%
rename from tests/plugins/test_manager.py
rename to saleor/plugins/tests/test_manager.py
index f4dfde9f4b..865eb3fc94 100644
--- a/tests/plugins/test_manager.py
+++ b/saleor/plugins/tests/test_manager.py
@@ -7,7 +7,7 @@ from prices import Money, TaxedMoney
from saleor.core.taxes import TaxType
from saleor.plugins.manager import PluginsManager, get_plugins_manager
from saleor.plugins.models import PluginConfiguration
-from tests.plugins.sample_plugins import (
+from saleor.plugins.tests.sample_plugins import (
ActivePaymentGateway,
InactivePaymentGateway,
PluginInactive,
@@ -17,7 +17,7 @@ from tests.plugins.sample_plugins import (
def test_get_plugins_manager():
manager_path = "saleor.plugins.manager.PluginsManager"
- plugin_path = "tests.plugins.sample_plugins.PluginSample"
+ plugin_path = "saleor.plugins.tests.sample_plugins.PluginSample"
manager = get_plugins_manager(manager_path=manager_path, plugins=[plugin_path])
assert isinstance(manager, PluginsManager)
assert len(manager.plugins) == 1
@@ -25,7 +25,7 @@ def test_get_plugins_manager():
@pytest.mark.parametrize(
"plugins, total_amount",
- [(["tests.plugins.sample_plugins.PluginSample"], "1.0"), ([], "15.0")],
+ [(["saleor.plugins.tests.sample_plugins.PluginSample"], "1.0"), ([], "15.0")],
)
def test_manager_calculates_checkout_total(
checkout_with_item, discount_info, plugins, total_amount
@@ -41,7 +41,7 @@ def test_manager_calculates_checkout_total(
@pytest.mark.parametrize(
"plugins, subtotal_amount",
- [(["tests.plugins.sample_plugins.PluginSample"], "1.0"), ([], "15.0")],
+ [(["saleor.plugins.tests.sample_plugins.PluginSample"], "1.0"), ([], "15.0")],
)
def test_manager_calculates_checkout_subtotal(
checkout_with_item, discount_info, plugins, subtotal_amount
@@ -56,7 +56,7 @@ def test_manager_calculates_checkout_subtotal(
@pytest.mark.parametrize(
"plugins, shipping_amount",
- [(["tests.plugins.sample_plugins.PluginSample"], "1.0"), ([], "0.0")],
+ [(["saleor.plugins.tests.sample_plugins.PluginSample"], "1.0"), ([], "0.0")],
)
def test_manager_calculates_checkout_shipping(
checkout_with_item, discount_info, plugins, shipping_amount
@@ -74,7 +74,7 @@ def test_manager_calculates_checkout_shipping(
@pytest.mark.parametrize(
"plugins, shipping_amount",
- [(["tests.plugins.sample_plugins.PluginSample"], "1.0"), ([], "10.0")],
+ [(["saleor.plugins.tests.sample_plugins.PluginSample"], "1.0"), ([], "10.0")],
)
def test_manager_calculates_order_shipping(order_with_lines, plugins, shipping_amount):
currency = order_with_lines.total.currency
@@ -91,7 +91,7 @@ def test_manager_calculates_order_shipping(order_with_lines, plugins, shipping_a
@pytest.mark.parametrize(
"plugins, amount",
- [(["tests.plugins.sample_plugins.PluginSample"], "1.0"), ([], "15.0")],
+ [(["saleor.plugins.tests.sample_plugins.PluginSample"], "1.0"), ([], "15.0")],
)
def test_manager_calculates_checkout_line_total(
checkout_with_item, discount_info, plugins, amount
@@ -107,7 +107,7 @@ def test_manager_calculates_checkout_line_total(
@pytest.mark.parametrize(
"plugins, amount",
- [(["tests.plugins.sample_plugins.PluginSample"], "1.0"), ([], "12.30")],
+ [(["saleor.plugins.tests.sample_plugins.PluginSample"], "1.0"), ([], "12.30")],
)
def test_manager_calculates_order_line(order_line, plugins, amount):
currency = order_line.unit_price.currency
@@ -120,7 +120,7 @@ def test_manager_calculates_order_line(order_line, plugins, amount):
"plugins, tax_rate_list",
[
(
- ["tests.plugins.sample_plugins.PluginSample"],
+ ["saleor.plugins.tests.sample_plugins.PluginSample"],
[TaxType(code="123", description="abc")],
),
([], []),
@@ -132,7 +132,7 @@ def test_manager_uses_get_tax_rate_choices(plugins, tax_rate_list):
@pytest.mark.parametrize(
"plugins, show_taxes",
- [(["tests.plugins.sample_plugins.PluginSample"], True), ([], False)],
+ [(["saleor.plugins.tests.sample_plugins.PluginSample"], True), ([], False)],
)
def test_manager_show_taxes_on_storefront(plugins, show_taxes):
assert show_taxes == PluginsManager(plugins=plugins).show_taxes_on_storefront()
@@ -140,7 +140,7 @@ def test_manager_show_taxes_on_storefront(plugins, show_taxes):
@pytest.mark.parametrize(
"plugins, price",
- [(["tests.plugins.sample_plugins.PluginSample"], "1.0"), ([], "10.0")],
+ [(["saleor.plugins.tests.sample_plugins.PluginSample"], "1.0"), ([], "10.0")],
)
def test_manager_apply_taxes_to_product(product, plugins, price):
country = Country("PL")
@@ -155,7 +155,7 @@ def test_manager_apply_taxes_to_product(product, plugins, price):
@pytest.mark.parametrize(
"plugins, price_amount",
- [(["tests.plugins.sample_plugins.PluginSample"], "1.0"), ([], "10.0")],
+ [(["saleor.plugins.tests.sample_plugins.PluginSample"], "1.0"), ([], "10.0")],
)
def test_manager_apply_taxes_to_shipping(
shipping_method, address, plugins, price_amount
@@ -169,7 +169,7 @@ def test_manager_apply_taxes_to_shipping(
@pytest.mark.parametrize(
"plugins, amount",
- [(["tests.plugins.sample_plugins.PluginSample"], "15.0"), ([], "0")],
+ [(["saleor.plugins.tests.sample_plugins.PluginSample"], "15.0"), ([], "0")],
)
def test_manager_get_tax_rate_percentage_value(plugins, amount, product):
country = Country("PL")
@@ -181,8 +181,8 @@ def test_manager_get_tax_rate_percentage_value(plugins, amount, product):
def test_manager_get_plugin_configurations(plugin_configuration):
plugins = [
- "tests.plugins.sample_plugins.PluginSample",
- "tests.plugins.sample_plugins.PluginInactive",
+ "saleor.plugins.tests.sample_plugins.PluginSample",
+ "saleor.plugins.tests.sample_plugins.PluginInactive",
]
manager = PluginsManager(plugins=plugins)
plugin_configs = manager._plugin_configs.values()
@@ -192,8 +192,8 @@ def test_manager_get_plugin_configurations(plugin_configuration):
def test_manager_get_plugin_configuration(plugin_configuration):
plugins = [
- "tests.plugins.sample_plugins.PluginSample",
- "tests.plugins.sample_plugins.PluginInactive",
+ "saleor.plugins.tests.sample_plugins.PluginSample",
+ "saleor.plugins.tests.sample_plugins.PluginInactive",
]
manager = PluginsManager(plugins=plugins)
plugin = manager.get_plugin(PluginSample.PLUGIN_ID)
@@ -204,7 +204,7 @@ def test_manager_get_plugin_configuration(plugin_configuration):
def test_manager_save_plugin_configuration(plugin_configuration):
- plugins = ["tests.plugins.sample_plugins.PluginSample"]
+ plugins = ["saleor.plugins.tests.sample_plugins.PluginSample"]
manager = PluginsManager(plugins=plugins)
manager.save_plugin_configuration(PluginSample.PLUGIN_ID, {"active": False})
plugin_configuration.refresh_from_db()
@@ -225,7 +225,9 @@ def test_plugin_updates_configuration_shape(
plugin_configuration.configuration + [new_config],
)
- manager = PluginsManager(plugins=["tests.plugins.sample_plugins.PluginSample"])
+ manager = PluginsManager(
+ plugins=["saleor.plugins.tests.sample_plugins.PluginSample"]
+ )
plugin = manager.get_plugin(PluginSample.PLUGIN_ID)
assert len(plugin.configuration) == 5
@@ -241,7 +243,9 @@ 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=["saleor.plugins.tests.sample_plugins.PluginInactive"]
+ )
plugin = manager.get_plugin(PluginInactive.PLUGIN_ID)
assert len(plugin.configuration) == 1
assert plugin.configuration[0] == {**new_config, **new_config_structure}
@@ -254,9 +258,9 @@ def test_manager_serve_list_of_payment_gateways():
"config": ActivePaymentGateway.CLIENT_CONFIG,
}
plugins = [
- "tests.plugins.sample_plugins.PluginSample",
- "tests.plugins.sample_plugins.ActivePaymentGateway",
- "tests.plugins.sample_plugins.InactivePaymentGateway",
+ "saleor.plugins.tests.sample_plugins.PluginSample",
+ "saleor.plugins.tests.sample_plugins.ActivePaymentGateway",
+ "saleor.plugins.tests.sample_plugins.InactivePaymentGateway",
]
manager = PluginsManager(plugins=plugins)
assert manager.list_payment_gateways() == [expected_gateway]
@@ -277,8 +281,8 @@ def test_manager_serve_list_all_payment_gateways():
]
plugins = [
- "tests.plugins.sample_plugins.ActivePaymentGateway",
- "tests.plugins.sample_plugins.InactivePaymentGateway",
+ "saleor.plugins.tests.sample_plugins.ActivePaymentGateway",
+ "saleor.plugins.tests.sample_plugins.InactivePaymentGateway",
]
manager = PluginsManager(plugins=plugins)
assert manager.list_payment_gateways(active_only=False) == expected_gateways
diff --git a/tests/plugins/test_plugins.py b/saleor/plugins/tests/test_plugins.py
similarity index 96%
rename from tests/plugins/test_plugins.py
rename to saleor/plugins/tests/test_plugins.py
index e250bbc0db..35f8c6ca35 100644
--- a/tests/plugins/test_plugins.py
+++ b/saleor/plugins/tests/test_plugins.py
@@ -1,12 +1,12 @@
from saleor.plugins.anonymize.plugin import AnonymizePlugin
from saleor.plugins.base_plugin import ConfigurationTypeField
from saleor.plugins.manager import get_plugins_manager
-from tests.plugins.sample_plugins import PluginSample
-from tests.plugins.utils import get_config_value
+from saleor.plugins.tests.sample_plugins import PluginSample
+from saleor.plugins.tests.utils import get_config_value
def test_update_config_items_keeps_bool_value(plugin_configuration, settings):
- settings.PLUGINS = ["tests.plugins.sample_plugins.PluginSample"]
+ settings.PLUGINS = ["saleor.plugins.tests.sample_plugins.PluginSample"]
data_to_update = [
{"name": "Username", "value": "[email protected]"},
{"name": "Use sandbox", "value": False},
@@ -163,7 +163,7 @@ def test_base_plugin__update_configuration_structure_configuration_has_change(
def test_base_plugin__append_config_structure_to_config(settings):
- settings.PLUGINS = ["tests.plugins.sample_plugins.PluginSample"]
+ settings.PLUGINS = ["saleor.plugins.tests.sample_plugins.PluginSample"]
manager = get_plugins_manager()
plugin = manager.get_plugin(PluginSample.PLUGIN_ID)
config = [
diff --git a/tests/plugins/utils.py b/saleor/plugins/tests/utils.py
similarity index 100%
rename from tests/plugins/utils.py
rename to saleor/plugins/tests/utils.py
diff --git a/saleor/plugins/vatlayer/tests/__init__.py b/saleor/plugins/vatlayer/tests/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/plugins/test_vatlayer.py b/saleor/plugins/vatlayer/tests/test_vatlayer.py
similarity index 99%
rename from tests/plugins/test_vatlayer.py
rename to saleor/plugins/vatlayer/tests/test_vatlayer.py
index 94c879fb56..cc06dd383b 100644
--- a/tests/plugins/test_vatlayer.py
+++ b/saleor/plugins/vatlayer/tests/test_vatlayer.py
@@ -246,7 +246,6 @@ def test_calculate_checkout_total(
)
@pytest.mark.parametrize(
"with_discount, expected_net, expected_gross, taxes_in_prices",
[
diff --git a/saleor/plugins/webhook/tests/__init__.py b/saleor/plugins/webhook/tests/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/plugins/cassettes/test_trigger_webhooks_for_event.yaml b/saleor/plugins/webhook/tests/cassettes/test_trigger_webhooks_for_event.yaml
similarity index 100%
rename from tests/plugins/cassettes/test_trigger_webhooks_for_event.yaml
rename to saleor/plugins/webhook/tests/cassettes/test_trigger_webhooks_for_event.yaml
diff --git a/tests/plugins/cassettes/test_trigger_webhooks_for_event_with_secret_key.yaml b/saleor/plugins/webhook/tests/cassettes/test_trigger_webhooks_for_event_with_secret_key.yaml
similarity index 100%
rename from tests/plugins/cassettes/test_trigger_webhooks_for_event_with_secret_key.yaml
rename to saleor/plugins/webhook/tests/cassettes/test_trigger_webhooks_for_event_with_secret_key.yaml
diff --git a/tests/plugins/test_webhook.py b/saleor/plugins/webhook/tests/test_webhook.py
similarity index 100%
rename from tests/plugins/test_webhook.py
rename to saleor/plugins/webhook/tests/test_webhook.py
diff --git a/tests/api/test_plugins.py b/tests/api/test_plugins.py
index 5be29d9c23..8570456d8d 100644
--- a/tests/api/test_plugins.py
+++ b/tests/api/test_plugins.py
@@ -6,9 +6,9 @@ from saleor.plugins.base_plugin import ConfigurationTypeField
from saleor.plugins.error_codes import PluginErrorCode
from saleor.plugins.manager import get_plugins_manager
from saleor.plugins.models import PluginConfiguration
+from saleor.plugins.tests.sample_plugins import PluginSample
+from saleor.plugins.tests.utils import get_config_value
from tests.api.utils import assert_no_permission, get_graphql_content
-from tests.plugins.sample_plugins import PluginSample
-from tests.plugins.utils import get_config_value
@pytest.fixture
@@ -43,7 +43,7 @@ PLUGINS_QUERY = """
def test_query_plugin_configurations(staff_api_client_can_manage_plugins, settings):
# Enable test plugin
- settings.PLUGINS = ["tests.plugins.sample_plugins.PluginSample"]
+ settings.PLUGINS = ["saleor.plugins.tests.sample_plugins.PluginSample"]
response = staff_api_client_can_manage_plugins.post_graphql(PLUGINS_QUERY)
content = get_graphql_content(response)
@@ -98,7 +98,7 @@ def test_query_plugins_hides_secret_fields(
settings,
):
- settings.PLUGINS = ["tests.plugins.sample_plugins.PluginSample"]
+ settings.PLUGINS = ["saleor.plugins.tests.sample_plugins.PluginSample"]
manager = get_plugins_manager()
plugin = manager.get_plugin(PluginSample.PLUGIN_ID)
configuration = copy.deepcopy(plugin.configuration)
@@ -132,7 +132,7 @@ def test_query_plugins_hides_secret_fields(
def test_query_plugin_configurations_as_customer_user(user_api_client, settings):
- settings.PLUGINS = ["tests.plugins.sample_plugins.PluginSample"]
+ settings.PLUGINS = ["saleor.plugins.tests.sample_plugins.PluginSample"]
response = user_api_client.post_graphql(PLUGINS_QUERY)
assert_no_permission(response)
@@ -295,7 +295,7 @@ def test_plugin_configuration_update(
staff_api_client_can_manage_plugins, settings, active, updated_configuration_item
):
- settings.PLUGINS = ["tests.plugins.sample_plugins.PluginSample"]
+ settings.PLUGINS = ["saleor.plugins.tests.sample_plugins.PluginSample"]
manager = get_plugins_manager()
plugin = manager.get_plugin(PluginSample.PLUGIN_ID)
old_configuration = copy.deepcopy(plugin.configuration)
@@ -343,7 +343,7 @@ def test_plugin_configuration_update_containing_invalid_plugin_id(
def test_plugin_update_saves_boolean_as_boolean(
staff_api_client_can_manage_plugins, settings
):
- settings.PLUGINS = ["tests.plugins.sample_plugins.PluginSample"]
+ settings.PLUGINS = ["saleor.plugins.tests.sample_plugins.PluginSample"]
manager = get_plugins_manager()
plugin = manager.get_plugin(PluginSample.PLUGIN_ID)
use_sandbox = get_config_value("Use sandbox", plugin.configuration)
@@ -375,9 +375,9 @@ def test_plugins_query_with_filter(
plugin_filter, count, staff_api_client_can_manage_plugins, settings
):
settings.PLUGINS = [
- "tests.plugins.sample_plugins.PluginSample",
- "tests.plugins.sample_plugins.PluginInactive",
- "tests.plugins.sample_plugins.ActivePlugin",
+ "saleor.plugins.tests.sample_plugins.PluginSample",
+ "saleor.plugins.tests.sample_plugins.PluginInactive",
+ "saleor.plugins.tests.sample_plugins.ActivePlugin",
]
query = """
query ($filter: PluginFilterInput) {
@@ -398,7 +398,7 @@ def test_plugins_query_with_filter(
def test_plugin_configuration_update_as_customer_user(user_api_client, settings):
- settings.PLUGINS = ["tests.plugins.sample_plugins.PluginSample"]
+ settings.PLUGINS = ["saleor.plugins.tests.sample_plugins.PluginSample"]
manager = get_plugins_manager()
plugin = manager.get_plugin(PluginSample.PLUGIN_ID)
@@ -450,9 +450,9 @@ def test_query_plugins_with_sort(
plugin_sort, result_order, staff_api_client_can_manage_plugins, settings
):
settings.PLUGINS = [
- "tests.plugins.sample_plugins.PluginSample",
- "tests.plugins.sample_plugins.PluginInactive",
- "tests.plugins.sample_plugins.ActivePlugin",
+ "saleor.plugins.tests.sample_plugins.PluginSample",
+ "saleor.plugins.tests.sample_plugins.PluginInactive",
+ "saleor.plugins.tests.sample_plugins.ActivePlugin",
]
variables = {"sort_by": plugin_sort}
response = staff_api_client_can_manage_plugins.post_graphql(