Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arctixdev committed Apr 10, 2023
1 parent 32ca97c commit 5cac891
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/resources/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,33 @@ def test_get_tracks(self, user):
assert isinstance(track, deezer.Track)
assert repr(track) == "<Track: Poney Pt. I>"
assert len(tracks) == 3

def test_recommendations_track(self, user):
tracks = user.get_recommendations_track()
assert isinstance(tracks, deezer.PaginatedList)
track = tracks[0]
assert isinstance(track, deezer.Track)

def test_recommendations_album(self, user):
albums = user.get_recommendations_album()
assert isinstance(albums, deezer.PaginatedList)
album = albums[0]
assert isinstance(album, deezer.Album)

def test_recommendations_artist(self, user):
artists = user.get_recommendations_artists()
assert isinstance(artists, deezer.PaginatedList)
artist = artists[0]
assert isinstance(artist, deezer.Artist)

def test_recommendations_playlist(self, user):
playlists = user.get_recommendations_playlist()
assert isinstance(playlists, deezer.PaginatedList)
playlist = playlists[0]
assert isinstance(playlist, deezer.Playlist)

def test_get_flow(self, user):
flow = user.get_flow()
assert isinstance(flow, deezer.PaginatedList)
track = flow[0]
assert isinstance(track, deezer.Track)
9 changes: 9 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,15 @@ def test_search_artists(self, client):
assert first.name == "Daft Punk"
assert len(result) == 5

def test_search_playlists(self, client):
"""Test search for playlists"""
result = client.search_playlists("Daft Punk")
assert isinstance(result, deezer.PaginatedList)
first = result[0]
assert isinstance(first, deezer.Playlist)
assert first.name == "100% Daft Punk"
assert len(result) == 5

@pytest.mark.parametrize(
("header_value", "expected_name"),
[
Expand Down

0 comments on commit 5cac891

Please sign in to comment.