Esempio n. 1
0
def test_remove_playlist(client, created_playlist):

    assert client.find_playlist("test", 4) == created_playlist

    client.remove_playlist(created_playlist)

    assert client.find_playlist("test", 4) >= 2**32 - 1
Esempio n. 2
0
def test_create_playlist_ex(request, client, test_files):
    files = [test_file.path for test_file in test_files]
    playlist = client.create_playlist_ex("test", 4, 1, files)

    request.addfinalizer(lambda: client.remove_playlist(playlist))

    count = client.playlist_get_item_count(playlist)
    assert count == len(files)
Esempio n. 3
0
def test_create_playlist_with_unicode_name(request, client):

    request.addfinalizer(lambda: client.remove_playlist(playlist_index))

    # The romanian for "dirt".
    name = "țărână".encode()
    playlist_index = client.create_playlist(name, 12, 1)

    assert client.get_playlist_count() == 2

    actual_name = client.playlist_get_name(playlist_index)
    assert actual_name == name
Esempio n. 4
0
def test_playlist_loading_saving(request, client, test_files):
    path = os.path.join(tempfile.gettempdir(), 'playlist.fpl')
    request.addfinalizer(lambda: os.remove(path))
    request.addfinalizer(lambda: client.remove_playlist(1))

    client.save_playlist(path, [test_file.path for test_file in test_files])
    assert os.path.exists(path)

    client.load_playlist(path)

    assert client.get_playlist_count() == 2

    contents = client.playlist_get_all_items(1)
    assert len(contents) == len(test_files)

    expected_paths = [test_file.path.encode() for test_file in test_files]
    actual_paths = [dict(item)[b'path'] for item in contents]

    assert expected_paths == actual_paths
Esempio n. 5
0
 def playlists_finalizer():
     for playlist in playlists:
         client.remove_playlist(playlist)
Esempio n. 6
0
def test_find_or_create_playlist_unlocked(request, client):
    playlist = client.find_or_create_playlist_unlocked("test", 4)
    request.addfinalizer(lambda: client.remove_playlist(playlist))

    assert playlist == 1
Esempio n. 7
0
def test_create_playlist_autoname(request, client):
    playlist = client.create_playlist_autoname(1)
    request.addfinalizer(lambda: client.remove_playlist(playlist))

    name = client.playlist_get_name(playlist)
    assert name == b'New Playlist'