def test_load_module(): with override_settings(INSTALLED_APPS=["shuup_tests.core"], MODULE_TEST_MODULE="mtm1"): mtm = load_module("MODULE_TEST_MODULE", "module_test_module") assert mtm.greeting == "Hello" with override_settings(INSTALLED_APPS=["shuup_tests.core"], MODULE_TEST_MODULE="mtm2"): mtm = load_module("MODULE_TEST_MODULE", "module_test_module") assert mtm.greeting == "Hola" with override_settings(MODULE_TEST_MODULE="mtm2"): with pytest.raises(ImproperlyConfigured): load_module("MODULE_TEST_MODULE", "module_test_module")
def get_tax_module(): """ Get the TaxModule specified in settings. :rtype: shuup.core.taxing.TaxModule """ return load_module("SHUUP_TAX_MODULE", "tax_module")()
def test_load_module(): with override_settings( INSTALLED_APPS=["shuup_tests.core"], MODULE_TEST_MODULE="mtm1" ): mtm = load_module("MODULE_TEST_MODULE", "module_test_module") assert mtm.greeting == "Hello" with override_settings( INSTALLED_APPS=["shuup_tests.core"], MODULE_TEST_MODULE="mtm2" ): mtm = load_module("MODULE_TEST_MODULE", "module_test_module") assert mtm.greeting == "Hola" with override_settings( MODULE_TEST_MODULE="mtm2" ): with pytest.raises(ImproperlyConfigured): load_module("MODULE_TEST_MODULE", "module_test_module")
def get_pricing_module(): """ :rtype: shuup.core.pricing.PricingModule """ return load_module("SHUUP_PRICING_MODULE", "pricing_module")()