Cache songs on get playlist details
This commit is contained in:
@@ -98,12 +98,27 @@ def test_caching_get_playlist_details(
|
||||
|
||||
# Ingest an empty list (for example, no playlists added yet to server).
|
||||
cache_adapter.ingest_new_data(
|
||||
FilesystemAdapter.FunctionNames.GET_PLAYLIST_DETAILS, ('1', ),
|
||||
SubsonicAPI.PlaylistWithSongs('1', 'test1', songs=[]))
|
||||
FilesystemAdapter.FunctionNames.GET_PLAYLIST_DETAILS,
|
||||
('1', ),
|
||||
SubsonicAPI.PlaylistWithSongs(
|
||||
'1',
|
||||
'test1',
|
||||
songs=[
|
||||
SubsonicAPI.Child(
|
||||
'1', 'Song 1', duration=timedelta(seconds=10.2)),
|
||||
SubsonicAPI.Child(
|
||||
'2', 'Song 2', duration=timedelta(seconds=20.8)),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
playlist = cache_adapter.get_playlist_details('1')
|
||||
assert playlist.id == '1'
|
||||
assert playlist.name == 'test1'
|
||||
assert playlist.song_count == 2
|
||||
assert playlist.duration == timedelta(seconds=31)
|
||||
assert (playlist.songs[0].id, playlist.songs[0].title) == ('1', 'Song 1')
|
||||
assert (playlist.songs[1].id, playlist.songs[1].title) == ('2', 'Song 2')
|
||||
|
||||
with pytest.raises(CacheMissError):
|
||||
cache_adapter.get_playlist_details('2')
|
||||
|
Reference in New Issue
Block a user