Skip to content

Commit

Permalink
Merge pull request #215 from tamland/209-fix-tests
Browse files Browse the repository at this point in the history
209 fix tests
  • Loading branch information
tehkillerbee authored Nov 29, 2023
2 parents fd81b6f + efc9416 commit 85271ad
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ def get_credential_store() -> tuple[List[Credentials], Optional[dict]]:

def login(request):
stores, credentials = get_credential_store()
config = tidalapi.Config(quality=tidalapi.Quality.hi_res)
config = tidalapi.Config()

tidal_session = tidalapi.Session(config)
if credentials and tidal_session.load_oauth_session(**credentials):
return tidal_session
Expand Down
9 changes: 5 additions & 4 deletions tests/test_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ def test_get_albums_ep_singles(session):


def test_get_albums_other(session):
artist = session.artist(16147)
artist = session.artist(17123)
albums = [
session.album(108748620),
session.album(97216346),
session.album(327452387),
session.album(322406553),
]

other_albums = artist.get_albums_other
# artist_item_ids = [item.id for item in other_albums()]
find_ids(albums, artist.get_albums_other)


Expand Down
10 changes: 6 additions & 4 deletions tests/test_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_track(session):


def test_track_url(session):
session.config = tidalapi.Config(quality=tidalapi.Quality.hi_res)
session.config = tidalapi.Config()
track = session.track(142278122)
assert "audio.tidal.com" in track.get_url()

Expand Down Expand Up @@ -99,7 +99,9 @@ def test_track_streaming(session):
track = session.track(62392768)
stream = track.stream()
assert stream.audio_mode == "STEREO"
assert stream.audio_quality == "LOSSLESS"
assert (
stream.audio_quality == tidalapi.Quality.low_320k.value
) # i.e. the default quality for the current session


def test_video(session):
Expand All @@ -110,7 +112,7 @@ def test_video(session):
assert video.track_num == 0
assert video.volume_num == 0
assert video.release_date == datetime(2019, 12, 26, tzinfo=tz.tzutc())
assert video.tidal_release_date == datetime(2019, 12, 27, 8, tzinfo=tz.tzutc())
assert video.tidal_release_date == datetime(2019, 12, 27, 9, tzinfo=tz.tzutc())
assert video.duration == 237
assert video.video_quality == "MP4_1080P"
assert video.available is True
Expand Down Expand Up @@ -161,7 +163,7 @@ def test_live_video(session):
assert live.track_num == 1
assert live.volume_num == 1
assert live.release_date == datetime(2021, 4, 1, tzinfo=tz.tzutc())
assert live.tidal_release_date == datetime(2021, 4, 1, 17, tzinfo=tz.tzutc())
assert live.tidal_release_date == datetime(2021, 4, 1, 18, tzinfo=tz.tzutc())
assert live.duration == 204
assert live.video_quality == "MP4_1080P"
assert live.available is True
Expand Down
2 changes: 1 addition & 1 deletion tests/test_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_genres(session):
def test_moods(session):
moods = session.moods()
first = next(iter(moods))
assert first.title == "Music School"
assert first.title == "Collabs"
assert isinstance(next(iter(first.get())), tidalapi.Playlist)


Expand Down
7 changes: 5 additions & 2 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def test_search(session):
assert isinstance(search["tracks"][0], Track)
assert isinstance(search["videos"][0], Video)
assert isinstance(search["playlists"][0], Playlist)
assert "Walker" in search["top_hit"].artist.name
top_hit = search["top_hit"]
assert "Walker" in top_hit.name


@pytest.mark.xfail(reason="Tidal now returns a video.")
Expand Down Expand Up @@ -130,7 +131,9 @@ def test_invalid_search(session):

def test_config(session):
assert session.config.item_limit == 1000
assert session.config.quality == tidalapi.Quality.low_320k.value
assert (
session.config.quality == tidalapi.Quality.low_320k.value
) # i.e. the default quality for the current session
assert session.config.video_quality == tidalapi.VideoQuality.high.value
assert session.config.alac is True

Expand Down

0 comments on commit 85271ad

Please sign in to comment.