2525
2626logging .basicConfig (level = logging .DEBUG )
2727
28+
2829@pytest .fixture (scope = 'session' )
2930def session ():
3031 session = tidalapi .Session ()
@@ -33,28 +34,34 @@ def session():
3334 session .login (username , password )
3435 return session
3536
37+
3638def test_get_artist (session ):
3739 artist_id = 16147
3840 artist = session .get_artist (artist_id )
3941 assert artist .id == artist_id
4042 assert artist .name == 'Lasgo'
4143
44+
4245def test_get_artist_albums (session ):
4346 albums = session .get_artist_albums (16147 )
4447 assert albums [0 ].name == 'Some Things'
4548
49+
4650def test_get_artist_albums_ep_single (session ):
4751 albums = session .get_artist_albums_ep_singles (16147 )
4852 assert any ([a .name == 'Feeling Alive' for a in albums ])
4953
54+
5055def test_get_artist_albums_other (session ):
5156 albums = session .get_artist_albums_other (16147 )
5257 assert any ([a .name == 'Dance History 1.0' for a in albums ])
5358
59+
5460def test_get_artist_videos (session ):
5561 videos = session .get_artist_videos (3502112 )
5662 assert any ([v .name == 'Call on Me' for v in videos ])
5763
64+
5865def test_get_album (session ):
5966 album_id = 17927863
6067 album = session .get_album (album_id )
@@ -66,6 +73,7 @@ def test_get_album(session):
6673 assert album .artist .name == 'Lasgo'
6774 assert album .artists [0 ].name == 'Lasgo'
6875
76+
6977def test_get_album_tracks (session ):
7078 tracks = session .get_album_tracks (17925106 )
7179 assert tracks [0 ].name == 'Take-Off'
@@ -78,6 +86,7 @@ def test_get_album_tracks(session):
7886 assert tracks [- 1 ].duration == 210
7987 assert tracks [- 1 ].version == 'Acoustic Version'
8088
89+
8190def test_get_album_videos (session ):
8291 videos = session .get_album_videos (108046179 )
8392 assert videos [0 ].name == 'Formation (Choreography Version)'
@@ -89,6 +98,7 @@ def test_get_album_videos(session):
8998 assert videos [1 ].track_num == 15
9099 assert videos [1 ].duration == 3955
91100
101+
92102def test_get_album_items (session ):
93103 items = session .get_album_items (108046179 )
94104 assert items [0 ].name == 'Pray You Catch Me'
@@ -101,37 +111,45 @@ def test_get_album_items(session):
101111 assert items [- 1 ].duration == 3955
102112 assert items [- 1 ].type == 'Music Video'
103113
114+
104115def test_artist_radio (session ):
105116 tracks = session .get_artist_radio (16147 )
106117 assert tracks
107118
119+
108120def test_search (session ):
109121 res = session .search ('artist' , 'lasgo' )
110122 assert res .artists [0 ].name == "Lasgo"
111123
124+
112125def test_artist_picture (session ):
113126 artist = session .get_artist (16147 )
114127 assert requests .get (artist .picture (640 ,640 )).status_code == 200
115128 assert requests .get (tidalapi .models .Artist .image .fget (artist , 640 , 640 )).status_code == 200
116129
130+
117131def test_album_picture (session ):
118132 album = session .get_album (17925106 )
119133 assert requests .get (album .picture (640 , 640 )).status_code == 200
120134 assert requests .get (tidalapi .models .Album .image .fget (album , 640 , 640 )).status_code == 200
121135
136+
122137def test_playlist_picture (session ):
123138 playlist = session .get_playlist ('33136f5a-d93a-4469-9353-8365897aaf94' )
124139 assert requests .get (playlist .picture (750 , 750 )).status_code == 200
125140 assert requests .get (tidalapi .models .Playlist .image .fget (playlist , 750 , 750 )).status_code == 200
126141
142+
127143def test_get_track_url (session ):
128144 track = session .get_track (108043415 )
129145 session .get_track_url (track .id )
130146
147+
131148def test_get_video_url (session ):
132149 video = session .get_video (108046194 )
133150 session .get_video_url (video .id )
134151
152+
135153def test_load_session (session ):
136154 """
137155 Test loading a session from a session id without supplying country code and user_id
0 commit comments