コード例 #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
コード例 #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)
コード例 #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
コード例 #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
コード例 #5
0
 def playlists_finalizer():
     for playlist in playlists:
         client.remove_playlist(playlist)
コード例 #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
コード例 #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'