mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-10-11 09:10:45 +00:00
Support for offset/limit with album/album_tracks API
This commit is contained in:
1 parent
c075f80470
commit
bbed19fdaa
5 files changed
+64
-45
No files matched your search
@@ -15,6 +15,8 @@ class TestSpotipy(unittest.TestCase):
|
||||
weezer_urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu'
|
||||
pablo_honey_urn = 'spotify:album:6AZv3m27uyRxi8KyJSfUxL'
|
||||
radiohead_urn = 'spotify:artist:4Z8W4fKeB5YxbusRsdQVPb'
|
||||
angeles_haydn_urn = 'spotify:album:1vAbqAeuJVWNAe7UR00bdM'
|
||||
|
||||
|
||||
bad_id = 'BAD_ID'
|
||||
|
||||
@@ -38,6 +40,17 @@ class TestSpotipy(unittest.TestCase):
|
||||
results = self.spotify.album_tracks(self.pinkerton_urn)
|
||||
self.assertTrue(len(results['items']) == 10)
|
||||
|
||||
def test_album_tracks_many(self):
|
||||
results = self.spotify.album_tracks(self.angeles_haydn_urn)
|
||||
tracks = results['items']
|
||||
total, received = results['total'], len(tracks)
|
||||
while received < total:
|
||||
results = self.spotify.album_tracks(self.angeles_haydn_urn, offset=received)
|
||||
tracks.extend(results['items'])
|
||||
received = len(tracks)
|
||||
|
||||
self.assertEqual(received, total)
|
||||
|
||||
def test_albums(self):
|
||||
results = self.spotify.albums([self.pinkerton_urn, self.pablo_honey_urn])
|
||||
self.assertTrue('albums' in results)
|
||||
|
||||
Reference in new issue
Block a user