Beispiel #1
0
def test_theme_settings_api():
    with override_provides("xtheme", [
        "shuup_tests.xtheme.utils:FauxTheme",
        "shuup_tests.xtheme.utils:FauxTheme2"
    ]):
        ThemeSettings.objects.all().delete()
        theme = get_theme_by_identifier(FauxTheme2.identifier)
        theme.set_setting("foo", "bar")
        theme.set_settings(quux=[4, 8, 15, 16, 23, 42])
        theme = get_theme_by_identifier(FauxTheme2.identifier)
        assert theme.get_setting("foo") == "bar"
        assert theme.get_settings() == {
            "foo": "bar",
            "quux": [4, 8, 15, 16, 23, 42]
        }
Beispiel #2
0
def test_theme_settings_api():
    with override_provides("xtheme", [
            "shuup_tests.xtheme.utils:FauxTheme",
            "shuup_tests.xtheme.utils:FauxTheme2"
    ]):
        ThemeSettings.objects.all().delete()
        theme = get_theme_by_identifier(FauxTheme2.identifier)
        theme.set_setting("foo", "bar")
        theme.set_settings(quux=[4, 8, 15, 16, 23, 42])
        theme = get_theme_by_identifier(FauxTheme2.identifier)
        assert theme.get_setting("foo") == "bar"
        assert theme.get_settings() == {
            "foo": "bar",
            "quux": [4, 8, 15, 16, 23, 42]
        }
Beispiel #3
0
def test_get_by_identifier_theme(rf):
    with override_provides("xtheme", [
            "shuup_tests.xtheme.utils:FauxTheme",
            "shuup_tests.xtheme.utils:FauxTheme2"
    ]):
        shop1 = Shop.objects.create(identifier="shop1", domain="shop-1")
        shop2 = Shop.objects.create(identifier="shop2", domain="shop-test-2")

        theme = get_theme_by_identifier(FauxTheme2.identifier, shop1)
        assert theme.settings_obj.theme_identifier == FauxTheme2.identifier
        assert theme.settings_obj.shop.id == shop1.id

        theme = get_theme_by_identifier(FauxTheme.identifier, shop2)
        assert theme.settings_obj.theme_identifier == FauxTheme.identifier
        assert theme.settings_obj.shop.id == shop2.id
Beispiel #4
0
def test_get_by_identifier_theme(rf):
    with override_provides("xtheme", [
        "shuup_tests.xtheme.utils:FauxTheme",
        "shuup_tests.xtheme.utils:FauxTheme2"
    ]):
        shop1 = Shop.objects.create(identifier="shop1", domain="shop-1")
        shop2 = Shop.objects.create(identifier="shop2", domain="shop-test-2")

        theme = get_theme_by_identifier(FauxTheme2.identifier, shop1)
        assert theme.settings_obj.theme_identifier == FauxTheme2.identifier
        assert theme.settings_obj.shop.id == shop1.id

        theme = get_theme_by_identifier(FauxTheme.identifier, shop2)
        assert theme.settings_obj.theme_identifier == FauxTheme.identifier
        assert theme.settings_obj.shop.id == shop2.id