Skip to content

Commit 0c3b851

Browse files
committed
Added pagination tests for playlist, updated misc tests
1 parent 3996469 commit 0c3b851

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

tests/test_user.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ def test_get_favorite_tracks(session):
430430
favorites = session.user.favorites
431431
tracks = favorites.tracks_paginated()
432432
tracks_count = favorites.get_tracks_count()
433-
assert len(tracks) > 0 # and tracks_count == len(tracks)
433+
# Only the available tracks are returned so the final track count might be lower
434+
assert len(tracks) > 0 and tracks_count >= len(tracks)
434435
assert isinstance(tracks[0], tidalapi.Track)
435436

436437

@@ -486,7 +487,7 @@ def test_get_favorite_videos(session):
486487
favorites = session.user.favorites
487488
videos = favorites.videos_paginated()
488489
videos_count = favorites.get_videos_count()
489-
assert len(videos) == videos_count and videos_count > 0
490+
assert videos_count > 0 and len(videos) == videos_count
490491
assert isinstance(videos[0], tidalapi.media.Video)
491492

492493

@@ -496,6 +497,14 @@ def test_add_remove_favorite_video(session):
496497
add_remove(video_id, favorites.add_video, favorites.remove_video, favorites.videos)
497498

498499

500+
def test_get_favorite_playlists(session):
501+
favorites = session.user.favorites
502+
playlists = favorites.playlists_paginated()
503+
playlists_count = favorites.get_playlists_count()
504+
assert len(playlists) > 0 and playlists_count == len(playlists)
505+
assert isinstance(playlists[0], tidalapi.Playlist)
506+
507+
499508
def test_get_favorite_playlists_order(session):
500509
# Add 5 favourite playlists to ensure enough playlists exist for the tests
501510
playlist_ids = [

0 commit comments

Comments
 (0)