Skip to content

Commit 98449a1

Browse files
committed
Update various tests (favorites, paginated)
1 parent c424f32 commit 98449a1

File tree

1 file changed

+39
-7
lines changed

1 file changed

+39
-7
lines changed

tests/test_user.py

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,14 @@ def assert_playlists_present(expected_ids: list[str], should_exist: bool):
417417
assert_playlists_present(playlists_multiple, should_exist=False)
418418

419419

420+
def test_get_favorite_tracks(session):
421+
favorites = session.user.favorites
422+
tracks = favorites.tracks_paginated()
423+
tracks_count = favorites.get_tracks_count()
424+
assert len(tracks) > 0 # and tracks_count == len(tracks)
425+
assert isinstance(tracks[0], tidalapi.Track)
426+
427+
420428
def test_add_remove_favorite_track(session):
421429
favorites = session.user.favorites
422430
track_id = 32961853
@@ -458,17 +466,18 @@ def assert_tracks_present(expected_ids: list[str], should_exist: bool):
458466
assert_tracks_present(tracks_multiple, should_exist=False)
459467

460468

461-
def test_add_remove_favorite_video(session):
469+
def test_get_favorite_videos(session):
462470
favorites = session.user.favorites
463-
video_id = 160850422
464-
add_remove(video_id, favorites.add_video, favorites.remove_video, favorites.videos)
471+
videos = favorites.videos_paginated()
472+
videos_count = favorites.get_videos_count()
473+
assert len(videos) == videos_count and videos_count > 0
474+
assert isinstance(videos[0], tidalapi.media.Video)
465475

466476

467-
def test_get_favorite_mixes(session):
477+
def test_add_remove_favorite_video(session):
468478
favorites = session.user.favorites
469-
mixes = favorites.mixes()
470-
assert len(mixes) > 0
471-
assert isinstance(mixes[0], tidalapi.MixV2)
479+
video_id = 160850422
480+
add_remove(video_id, favorites.add_video, favorites.remove_video, favorites.videos)
472481

473482

474483
def test_get_favorite_playlists_order(session):
@@ -517,6 +526,14 @@ def get_playlist_ids(**kwargs) -> list[str]:
517526
assert session.user.favorites.remove_playlist(playlist_ids)
518527

519528

529+
def test_get_favorite_albums(session):
530+
favorites = session.user.favorites
531+
albums = favorites.albums_paginated()
532+
albums_count = favorites.get_albums_count()
533+
assert len(albums) > 0 and albums_count == len(albums)
534+
assert isinstance(albums[0], tidalapi.Album)
535+
536+
520537
def test_get_favorite_albums_order(session):
521538
album_ids = [
522539
"446470480",
@@ -576,6 +593,13 @@ def get_album_ids(**kwargs) -> list[str]:
576593
assert session.user.favorites.remove_album(album_id)
577594

578595

596+
def test_get_favorite_mixes(session):
597+
favorites = session.user.favorites
598+
mixes = favorites.mixes()
599+
assert len(mixes) > 0
600+
assert isinstance(mixes[0], tidalapi.MixV2)
601+
602+
579603
def test_get_favorite_mixes_order(session):
580604
mix_ids = [
581605
"0007646f7c64d03d56846ed25dae3d",
@@ -633,6 +657,14 @@ def get_mix_ids(**kwargs) -> list[str]:
633657
assert session.user.favorites.remove_mixes(mix_ids, validate=True)
634658

635659

660+
def test_get_favorite_artists(session):
661+
favorites = session.user.favorites
662+
artists = favorites.artists_paginated()
663+
artists_count = favorites.get_artists_count()
664+
assert len(artists) > 0 and artists_count == len(artists)
665+
assert isinstance(artists[0], tidalapi.Artist)
666+
667+
636668
def test_get_favorite_artists_order(session):
637669
artist_ids = [
638670
"4836523",

0 commit comments

Comments
 (0)