Skip to content

Commit

Permalink
Disable TIDAL API testing until workaround for API limits is found
Browse files Browse the repository at this point in the history
  • Loading branch information
bbye98 committed Nov 25, 2023
1 parent bed3d2c commit acd0d73
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 58 deletions.
Binary file modified tests/data/previews/spektrem_shine.mp3
Binary file not shown.
Binary file modified tests/data/previews/tobu_back_to_you.flac
Binary file not shown.
Binary file added tests/data/previews/tobu_back_to_you.mp3
Binary file not shown.
Binary file modified tests/data/samples/middle_c_alac.m4a
Binary file not shown.
Binary file modified tests/data/samples/middle_c_flac.ogg
Binary file not shown.
Binary file modified tests/data/samples/middle_c_opus.ogg
Binary file not shown.
Binary file modified tests/data/samples/middle_c_vorbis.ogg
Binary file not shown.
112 changes: 54 additions & 58 deletions tests/test_tidal.py
Original file line number Diff line number Diff line change
@@ -1,75 +1,71 @@
from pathlib import Path
import sys
import time

sys.path.insert(0, f"{Path(__file__).parents[1]}/src")
from minim import tidal # noqa: E402

class TestAPI:
# class TestAPI:

ALBUM_IDS = ["251380836", "275646830"]
ALBUM_BARCODE_ID = "196589525444"
ARTIST_IDS = ["1566", "7804"]
TRACK_IDS = ["251380837", "251380838"]
VIDEO_IDS = ["59727844", "75623239"]
# ALBUM_IDS = ["251380836", "275646830"]
# ALBUM_BARCODE_ID = "196589525444"
# ARTIST_IDS = ["1566", "7804"]
# TRACK_IDS = ["251380837", "251380838"]
# VIDEO_IDS = ["59727844", "75623239"]

@classmethod
def setup_class(cls):
cls.obj = tidal.API()
# @classmethod
# def setup_class(cls):
# cls.obj = tidal.API()

def teardown_method(self):
time.sleep(1)

def test_get_album(self):
album = self.obj.get_album(self.ALBUM_IDS[0], "US")
assert album["id"] == self.ALBUM_IDS[0]
# def test_get_album(self):
# album = self.obj.get_album(self.ALBUM_IDS[0], "US")
# assert album["id"] == self.ALBUM_IDS[0]

def test_get_albums(self):
albums = self.obj.get_albums(self.ALBUM_IDS, "US")
assert all(a["resource"]["id"] == i
for a, i in zip(albums["data"], self.ALBUM_IDS))
# def test_get_albums(self):
# albums = self.obj.get_albums(self.ALBUM_IDS, "US")
# assert all(a["resource"]["id"] == i
# for a, i in zip(albums["data"], self.ALBUM_IDS))

def test_get_album_items(self):
items = self.obj.get_album_items(self.ALBUM_IDS[0], "US")
assert all(i["resource"]["album"]["id"] == self.ALBUM_IDS[0]
for i in items["data"])
# def test_get_album_items(self):
# items = self.obj.get_album_items(self.ALBUM_IDS[0], "US")
# assert all(i["resource"]["album"]["id"] == self.ALBUM_IDS[0]
# for i in items["data"])

def test_get_album_by_barcode_id(self):
album = self.obj.get_album_by_barcode_id(self.ALBUM_BARCODE_ID, "US")
assert (album["data"][0]["resource"]["barcodeId"]
== self.ALBUM_BARCODE_ID)
# def test_get_album_by_barcode_id(self):
# album = self.obj.get_album_by_barcode_id(self.ALBUM_BARCODE_ID, "US")
# assert (album["data"][0]["resource"]["barcodeId"]
# == self.ALBUM_BARCODE_ID)

def test_get_artist(self):
artist = self.obj.get_artist(self.ARTIST_IDS[0], "US")
assert artist["id"] == self.ARTIST_IDS[0]

def test_get_artists(self):
artists = self.obj.get_artists(self.ARTIST_IDS, "US")
assert all(a["resource"]["id"] == i
for a, i in zip(artists["data"], self.ARTIST_IDS))
# def test_get_artist(self):
# artist = self.obj.get_artist(self.ARTIST_IDS[0], "US")
# assert artist["id"] == self.ARTIST_IDS[0]

# def test_get_artists(self):
# artists = self.obj.get_artists(self.ARTIST_IDS, "US")
# assert all(a["resource"]["id"] == i
# for a, i in zip(artists["data"], self.ARTIST_IDS))

def test_get_artist_albums(self):
albums = self.obj.get_artist_albums(self.ARTIST_IDS[0], "US")
assert all(a["resource"]["artists"][0]["id"] == self.ARTIST_IDS[0]
for a in albums["data"])

def test_get_track(self):
track = self.obj.get_track(self.TRACK_IDS[0], "US")
assert track["id"] == self.TRACK_IDS[0]

def test_get_tracks(self):
tracks = self.obj.get_tracks(self.TRACK_IDS, "US")
assert all(t["resource"]["id"] == i
for t, i in zip(tracks["data"], self.TRACK_IDS))

def test_get_video(self):
video = self.obj.get_video(self.VIDEO_IDS[0], "US")
assert video["id"] == self.VIDEO_IDS[0]

def test_get_videos(self):
videos = self.obj.get_videos(self.VIDEO_IDS, "US")
assert all(v["resource"]["id"] == i
for v, i in zip(videos["data"], self.VIDEO_IDS))
# def test_get_artist_albums(self):
# albums = self.obj.get_artist_albums(self.ARTIST_IDS[0], "US")
# assert all(a["resource"]["artists"][0]["id"] == self.ARTIST_IDS[0]
# for a in albums["data"])

# def test_get_track(self):
# track = self.obj.get_track(self.TRACK_IDS[0], "US")
# assert track["id"] == self.TRACK_IDS[0]

# def test_get_tracks(self):
# tracks = self.obj.get_tracks(self.TRACK_IDS, "US")
# assert all(t["resource"]["id"] == i
# for t, i in zip(tracks["data"], self.TRACK_IDS))

# def test_get_video(self):
# video = self.obj.get_video(self.VIDEO_IDS[0], "US")
# assert video["id"] == self.VIDEO_IDS[0]

# def test_get_videos(self):
# videos = self.obj.get_videos(self.VIDEO_IDS, "US")
# assert all(v["resource"]["id"] == i
# for v, i in zip(videos["data"], self.VIDEO_IDS))

class TestPrivateAPI:

Expand Down

0 comments on commit acd0d73

Please sign in to comment.