Beispiel #1
0
def test_set_current_theme_happy_path(models):
    assert get_current_theme() == None

    set_current_theme('inkas')
    assert get_current_theme() == 'inkas'

    set_current_theme(None)
    assert get_current_theme() == None
Beispiel #2
0
def test_set_current_theme_not_registered(models):
    assert get_current_theme() == None

    with pytest.raises(ValueError) as excinfo:
        set_current_theme('badtheme')
        assert excinfo.value.message == "Theme not registered: badtheme"

    assert get_current_theme() == None
Beispiel #3
0
def asset(path):
    theme = get_current_theme()
    if theme is None:
        return path
    if theme not in get_registered_themes():
        raise ValueError("Theme not registered: {0}".format(theme))
    return os.path.join(theme, path)
Beispiel #4
0
def test_get_current_theme_set(set_theme):
    set_theme('Theme')
    assert get_current_theme() == 'Theme'
Beispiel #5
0
def test_get_current_theme_none_set(clear_theme):
    clear_theme()
    assert get_current_theme() == None