@@ -0,0 +1,1546 @@
+#!/usr/bin/python%0Afrom nose.tools import *%0Afrom tempfile import mkdtemp%0Afrom subprocess import check_call, check_output%0Aimport os, time%0A%0Adef eventually_eq_(a, b_op, timeout=5, tick=0.1):%0A    time_spent = 0%0A    b = b_op()%0A    while (time_spent %3C timeout) and not a == b:%0A        time.sleep(tick)%0A        time_spent = time_spent + tick%0A        b = b_op()%0A%0A    if not a == b:%0A        raise AssertionError(%22%25r != %25r%22, a, b)%0A%0Atest_dir = None%0Adef setup_module():%0A    global test_dir%0A    test_dir = mkdtemp()%0A    print(%22Mounting at %25s%22 %25 test_dir)%0A    check_call(%5B%22./spotifile%22, test_dir%5D)%0A%0Adef teardown_module():%0A    global test_dir%0A    print(%22Unmounting %25s%22 %25 test_dir)%0A    check_call(%5B%22fusermount%22, %22-z%22, %22-u%22, test_dir%5D)%0A    os.rmdir(test_dir)%0A%0Adef spotifile_path(spath):%0A    global test_dir%0A    if isinstance(spath, list):%0A        return os.path.join(test_dir, *spath)%0A%0A    return os.path.join(test_dir, spath)%0A%0Adef logged_in():%0A    eventually_eq_(b'logged in',%0A            lambda: check_output(%5B%22cat%22, spotifile_path(%22connection%22)%5D))%0A%0A@with_setup(logged_in, None)%0Adef test_playlists():%0A    playlists = os.listdir(spotifile_path(%22playlists%22))%0A    assert_greater(len(playlists), 0)%0A    for pl in playlists:%0A        playlist_path = spotifile_path(%5Bspotifile_path(%22playlists%22), pl%5D)%0A        tracks = os.listdir(playlist_path)%0A        assert_greater(len(tracks), 0)%0A        for t in tracks:%0A            track_path = spotifile_path(%5Bplaylist_path, t%5D)%0A            track_content = os.listdir(track_path)%0A            assert_greater(len(track_content), 0)%0A

Add trivial test script