57b59b2daf6f05f6f0bc42375c8d92a8bc31505c — Hristos N. Triantafillou 16 days ago a85f647 master 0.22
Test for the 'no usable media' message
1 files changed, 17 insertions(+), 3 deletions(-)

M test_mousikofidi.py
M test_mousikofidi.py => test_mousikofidi.py +17 -3
@@ 254,9 254,6 @@ def test_breadcrumb_links_from_path_deep_file():
     base = os.path.join(tmpdir, "flac")
     tmpdeep = os.path.join(base, "SomeArtist", "SomeAlbum", "SomeDisc")
     os.makedirs(tmpdeep)
-    # expected_string = '<a href="/browse/{etmp}%2Fflac">{tmp}/flac</a> / <a href="/browse/{etmp}%2Fflac%2FSomeArtist">SomeArtist</a> / <a href="/browse/{etmp}%2Fflac%2FSomeArtist%2FSomeAlbum">SomeAlbum</a> / <a href="/browse/{etmp}%2Fflac%2FSomeArtist%2FSomeAlbum%2FSomeDisc">SomeDisc</a> / real.flac'.format(
-    #     etmp=quote(tmpdir), tmp=tmpdir
-    # )
 
     expected_string = '<a href="{url1}">{dir1}</a> / <a href="{url2}">{dir2}</a> / <a href="{url3}">{dir3}</a> / <a href="{url4}">{dir4}</a> / real.flac'.format(
         dir1=os.path.join(tmpdir, "flac"),


@@ 502,6 499,23 @@ def test_browse_dir():
     assert actual_dict == expected_dict
 
 
+def test_browse_dir_empty(client):
+    empty_dir = os.path.join(THIS_DIR, "example", "runit", "control")
+    empty_url = "/browse/" + empty_dir.strip("/")
+
+    dir_list = []
+    dir_list.append(empty_dir)
+    app.fidiConfig["config"]["music_dirs"] = dir_list
+
+    with app.app_context():
+        rv = client.get(empty_url)
+
+    assert (
+        b'<h2 class="bold center">No <a href="https://mousikofidi.info/user_guide/#valid-media-types"valid media files</a> were found here!</h2>'
+        in rv.data
+    )
+
+
 def test_browse_file():
     example_dir = os.path.join(THIS_DIR, "example")
     with app.test_request_context("/browse/" + example_dir.strip("/")):