def test_load_module():
    with override_settings(INSTALLED_APPS=["shoop_tests.core"],
                           MODULE_TEST_MODULE="mtm1"):
        mtm = load_module("MODULE_TEST_MODULE", "module_test_module")
        assert mtm.greeting == "Hello"

    with override_settings(INSTALLED_APPS=["shoop_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")
Exemple #2
0
def get_tax_module():
    """
    Get the TaxModule specified in settings.

    :rtype: shoop.core.taxing.TaxModule
    """
    return load_module("SHOOP_TAX_MODULE", "tax_module")()
Exemple #3
0
def get_tax_module():
    """
    Get the TaxModule specified in settings.

    :rtype: shoop.core.taxing.TaxModule
    """
    return load_module("SHOOP_TAX_MODULE", "tax_module")()
Exemple #4
0
def test_load_module():
    with override_settings(
        INSTALLED_APPS=["shoop_tests.core"],
        MODULE_TEST_MODULE="mtm1"
    ):
        mtm = load_module("MODULE_TEST_MODULE", "module_test_module")
        assert mtm.greeting == "Hello"

    with override_settings(
        INSTALLED_APPS=["shoop_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")
Exemple #5
0
def get_pricing_module():
    """
    :rtype: shoop.core.pricing.PricingModule
    """
    return load_module("SHOOP_PRICING_MODULE", "pricing_module")()
Exemple #6
0
def get_pricing_module():
    """
    :rtype: shoop.core.pricing.PricingModule
    """
    return load_module("SHOOP_PRICING_MODULE", "pricing_module")()