Example #1
0
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")
Example #2
0
def get_tax_module():
    """
    Get the TaxModule specified in settings.

    :rtype: shuup.core.taxing.TaxModule
    """
    return load_module("SHUUP_TAX_MODULE", "tax_module")()
Example #3
0
def get_tax_module():
    """
    Get the TaxModule specified in settings.

    :rtype: shuup.core.taxing.TaxModule
    """
    return load_module("SHUUP_TAX_MODULE", "tax_module")()
Example #4
0
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")
Example #5
0
def get_pricing_module():
    """
    :rtype: shuup.core.pricing.PricingModule
    """
    return load_module("SHUUP_PRICING_MODULE", "pricing_module")()
Example #6
0
def get_pricing_module():
    """
    :rtype: shuup.core.pricing.PricingModule
    """
    return load_module("SHUUP_PRICING_MODULE", "pricing_module")()