Ejemplo n.º 1
0
def test_theme_list_themes_invalid():

    with _ephemeral_directory() as dirname:
        with NamedTemporaryFile(mode='w+', suffix='.cfg', dir=dirname) as fp:
            path, filename = os.path.split(fp.name)
            theme_name = filename[:-4]

            fp.write('[theme]\n')
            fp.write('Upvote = invalid value\n')
            fp.flush()

            Theme.print_themes(path)
            themes, errors = Theme.list_themes(path)
            assert ('installed', theme_name) in errors
Ejemplo n.º 2
0
def test_theme_list_themes():

    with _ephemeral_directory() as dirname:
        with NamedTemporaryFile(mode='w+', suffix='.cfg', dir=dirname) as fp:
            path, filename = os.path.split(fp.name)
            theme_name = filename[:-4]

            fp.write('[theme]\n')
            fp.flush()

            Theme.print_themes(path)
            themes, errors = Theme.list_themes(path)
            assert not errors

            theme_strings = [t.display_string for t in themes]
            assert theme_name + ' (installed)' in theme_strings
            assert 'default (built-in)' in theme_strings
            assert 'monochrome (built-in)' in theme_strings
            assert 'molokai (preset)' in theme_strings