~hristoast/mousikofidi

2b9d5a0b4c5d4ab5d2e6a8c352d303a9ebfa6eb9 — Hristos N. Triantafillou 8 months ago 390e2b6
Fixing the css load order
2 files changed, 47 insertions(+), 26 deletions(-)

M mousikofidi/mousikofidi.py
M test_mousikofidi.py
M mousikofidi/mousikofidi.py => mousikofidi/mousikofidi.py +1 -1
@@ 1156,8 1156,8 @@ def select_css() -> tuple:
        path + "css/normalize" + ext,
        path + "fa/css/fontawesome" + ext,
        path + "fa/css/solid" + ext,
        path + "css/fidi" + ext,
        path + "css" + THEMES[theme] + ext,
        path + "css/fidi" + ext,
    ]

    if theme == "nes":

M test_mousikofidi.py => test_mousikofidi.py +46 -25
@@ 446,8 446,8 @@ def test_browse_dir():
            "/css/normalize.min.css",
            "/fa/css/fontawesome.min.css",
            "/fa/css/solid.min.css",
            "/css/fidi.min.css",
            "/css/water/light.standalone.min.css",
            "/css/fidi.min.css",
        ],
        "file_list": [
            "{}/fake.flac".format(example_dir),


@@ 528,8 528,8 @@ def test_browse_file():
            "/css/normalize.min.css",
            "/fa/css/fontawesome.min.css",
            "/fa/css/solid.min.css",
            "/css/fidi.min.css",
            "/css/water/light.standalone.min.css",
            "/css/fidi.min.css",
        ],
        "music_dirs": [
            {


@@ 599,7 599,6 @@ def test_dir_dict():
    example_dir = os.path.join(THIS_DIR, "example")
    d = os.path.join(THIS_DIR, "example")
    dd = dir_dict(d)
    print(dd)
    assert dd == {"name": "example", "path": "{}".format(example_dir).strip("/")}




@@ 631,8 630,8 @@ def test_request_context():
                "/css/normalize.min.css",
                "/fa/css/fontawesome.min.css",
                "/fa/css/solid.min.css",
                "/css/fidi.min.css",
                "/css/water/light.standalone.min.css",
                "/css/fidi.min.css",
            ],
            "debug": False,
            "favicon_path": favicon,


@@ 780,50 779,80 @@ def test_select_logo_dec_holiday():
def test_select_css_light():
    with app.test_request_context("/"):
        css, theme = select_css()
    assert css[-1] == "/css/water/light.standalone.min.css"
    assert css[0] == "/css/normalize.min.css"
    assert css[1] == "/fa/css/fontawesome.min.css"
    assert css[2] == "/fa/css/solid.min.css"
    assert css[3] == "/css/water/light.standalone.min.css"
    assert css[4] == "/css/fidi.min.css"
    assert theme == "light"


def test_select_css_dark():
    app.fidiConfig["config"]["theme"] = "dark"
    print(app.fidiConfig)
    with app.test_request_context("/"):
        css, theme = select_css()

    assert css[-1] == "/css/water/dark.standalone.min.css"
    assert css[0] == "/css/normalize.min.css"
    assert css[1] == "/fa/css/fontawesome.min.css"
    assert css[2] == "/fa/css/solid.min.css"
    assert css[3] == "/css/water/dark.standalone.min.css"
    assert css[4] == "/css/fidi.min.css"
    assert theme == "dark"


def test_select_css_nes():
    app.fidiConfig["config"]["theme"] = "nes"
    with app.test_request_context("/"):
        css, theme = select_css()

    assert css[0] == "/css/normalize.min.css"
    assert css[1] == "/fa/css/fontawesome.min.css"
    assert css[2] == "/fa/css/solid.min.css"
    assert css[3] == "/css/nes/nes.min.css"
    assert css[4] == "/css/fidi.min.css"
    assert css[5] == "/css/fidi-nes.min.css"
    assert theme == "nes"


def test_select_css_terminal():
    app.fidiConfig["config"]["theme"] = "terminal"
    print(app.fidiConfig)
    with app.test_request_context("/"):
        css, theme = select_css()

    assert css[-1] == "/css/terminal.min.css"
    assert css[0] == "/css/normalize.min.css"
    assert css[1] == "/fa/css/fontawesome.min.css"
    assert css[2] == "/fa/css/solid.min.css"
    assert css[3] == "/css/terminal.min.css"
    assert css[4] == "/css/fidi.min.css"
    assert theme == "terminal"


def test_select_css_terminal_green():
    app.fidiConfig["config"]["theme"] = "terminal-green"
    print(app.fidiConfig)
    with app.test_request_context("/"):
        css, theme = select_css()

    assert css[-1] == "/css/terminal-green.min.css"
    assert css[0] == "/css/normalize.min.css"
    assert css[1] == "/fa/css/fontawesome.min.css"
    assert css[2] == "/fa/css/solid.min.css"
    assert css[3] == "/css/terminal-green.min.css"
    assert css[4] == "/css/fidi.min.css"
    assert theme == "terminal-green"


def test_select_css_terminal_solarized():
    app.fidiConfig["config"]["theme"] = "terminal-solarized"
    print(app.fidiConfig)
    with app.test_request_context("/"):
        css, theme = select_css()

    # Reset the config
    app.fidiConfig["config"]["theme"] = "light"

    assert css[-1] == "/css/terminal-solarized.min.css"
    assert css[0] == "/css/normalize.min.css"
    assert css[1] == "/fa/css/fontawesome.min.css"
    assert css[2] == "/fa/css/solid.min.css"
    assert css[3] == "/css/terminal-solarized.min.css"
    assert css[4] == "/css/fidi.min.css"
    assert theme == "terminal-solarized"




@@ 841,8 870,8 @@ def test_handle_playlist_cmd_add():
                "/css/normalize.min.css",
                "/fa/css/fontawesome.min.css",
                "/fa/css/solid.min.css",
                "/css/fidi.min.css",
                "/css/water/light.standalone.min.css",
                "/css/fidi.min.css",
            ],
            "debug": False,
            "favicon_path": favicon,


@@ 910,8 939,8 @@ def test_handle_playlist_cmd_add_multi():
                "/css/normalize.min.css",
                "/fa/css/fontawesome.min.css",
                "/fa/css/solid.min.css",
                "/css/fidi.min.css",
                "/css/water/light.standalone.min.css",
                "/css/fidi.min.css",
            ],
            "debug": False,
            "favicon_path": favicon,


@@ 967,8 996,8 @@ def test_handle_playlist_cmd_clear():
                "/css/normalize.min.css",
                "/fa/css/fontawesome.min.css",
                "/fa/css/solid.min.css",
                "/css/fidi.min.css",
                "/css/water/light.standalone.min.css",
                "/css/fidi.min.css",
            ],
            "debug": False,
            "favicon_path": favicon,


@@ 1045,8 1074,8 @@ def test_handle_playlist_cmd_rm():
                "/css/normalize.min.css",
                "/fa/css/fontawesome.min.css",
                "/fa/css/solid.min.css",
                "/css/fidi.min.css",
                "/css/water/light.standalone.min.css",
                "/css/fidi.min.css",
            ],
            "debug": False,
            "favicon_path": favicon,


@@ 1641,10 1670,6 @@ def test_index_terminal_green_theme(client):
    # Reset the config
    app.fidiConfig = app._fidiConfig.copy()

    for line in rv.data.decode().split("\n"):
        if "css" in line:
            print(line)

    assert (
        b'<link href="/css/terminal-green.min.css" rel="stylesheet" type="text/css">'
        in rv.data


@@ 2072,10 2097,6 @@ def test_file_detail_real_flac(client):
        ),
        "utf8",
    )

    for line in rv.data.decode().split("\n"):
        print(line)

    assert (
        bytes(
            '<audio id="single" controls src="/serve/{}">'.format(