Skip to content

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

Add test to validate dummy plugin methods

Maciej Korycinski033445c91075
diff --git a/saleor/core/extensions/dummy_plugin.py b/saleor/core/extensions/dummy_plugin.py
index 13ad4a25b4..204baa4efa 100644
--- a/saleor/core/extensions/dummy_plugin.py
+++ b/saleor/core/extensions/dummy_plugin.py
@@ -4,6 +4,7 @@ from django_countries.fields import Country
from prices import Money, MoneyRange, TaxedMoney, TaxedMoneyRange
from ..taxes import TaxType, quantize_price
+from .plugin import BasePlugin
if TYPE_CHECKING:
from ...checkout.models import Checkout, CheckoutLine
@@ -12,7 +13,7 @@ if TYPE_CHECKING:
from ...order.models import OrderLine, Order
-class DummyPlugin:
+class DummyPlugin(BasePlugin):
"""Dummy plugin class which overwrites all base plugin methods. It should be used
when any other plugins are enabled"""
@@ -86,10 +87,12 @@ class DummyPlugin:
def postprocess_order_creation(self, order: "Order"):
return
- def assign_tax_to_object_meta(
+ def assign_data_to_object_meta(
self, obj: Union["Product", "ProductType"], tax_code: str
):
return
- def get_tax_from_object_meta(self, obj: Union["Product", "ProductType"]) -> TaxType:
+ def get_data_from_object_meta(
+ self, obj: Union["Product", "ProductType"]
+ ) -> TaxType:
return TaxType(code="", description="")
diff --git a/tests/extensions/test_dummy_plugin.py b/tests/extensions/test_dummy_plugin.py
new file mode 100644
index 0000000000..f2f659237a
--- /dev/null
+++ b/tests/extensions/test_dummy_plugin.py
@@ -0,0 +1,11 @@
+from saleor.core.extensions.dummy_plugin import DummyPlugin
+from saleor.core.extensions.plugin import BasePlugin
+
+
+def test_dummy_plugin_overwrites_all_base_plugin_methods():
+ assert isinstance(BasePlugin(), DummyPlugin.__bases__[0])
+ dummy_vars = vars(DummyPlugin)
+ for name in vars(BasePlugin):
+ if name.startswith("__"):
+ continue
+ assert name in dummy_vars