mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 01:03:53 +00:00
Addition of Test Cases (#818)
* Added test_categories_country to use optional country selection for categories method. * Added test_categories_locale for testing locale method of categories. * Added test_categories_limit_low and test_categories_limit_high to test the limit method of categories for edge cases. * Rearranged for flow * Added test_category_playlists_limit_low and test_category_playlists_limit_high for testing the limit method.
This commit is contained in:
parent
a4cfd83946
commit
1b0c426984
@ -359,6 +359,22 @@ class SpotipyBrowseApiTests(unittest.TestCase):
|
||||
response = self.spotify.categories()
|
||||
self.assertGreater(len(response['categories']), 0)
|
||||
|
||||
def test_categories_country(self):
|
||||
response = self.spotify.categories(country='US')
|
||||
self.assertGreater(len(response['categories']), 0)
|
||||
|
||||
def test_categories_locale(self):
|
||||
response = self.spotify.categories(locale='en_US')
|
||||
self.assertGreater(len(response['categories']), 0)
|
||||
|
||||
def test_categories_limit_low(self):
|
||||
response = self.spotify.categories(limit=1)
|
||||
self.assertEqual(len(response['categories']), 1)
|
||||
|
||||
def test_categories_limit_high(self):
|
||||
response = self.spotify.categories(limit=50)
|
||||
self.assertLessEqual(len(response['categories']), 50)
|
||||
|
||||
def test_category_playlists(self):
|
||||
response = self.spotify.categories()
|
||||
category = 'rock'
|
||||
@ -368,6 +384,25 @@ class SpotipyBrowseApiTests(unittest.TestCase):
|
||||
response = self.spotify.category_playlists(category_id=cat_id)
|
||||
self.assertGreater(len(response['playlists']["items"]), 0)
|
||||
|
||||
def test_category_playlists_limit_low(self):
|
||||
response = self.spotify.categories()
|
||||
category = 'rock'
|
||||
for cat in response['categories']['items']:
|
||||
cat_id = cat['id']
|
||||
if cat_id == category:
|
||||
response = self.spotify.category_playlists(category_id=cat_id, limit=1)
|
||||
self.assertEqual(len(response['categories']['items']), 1)
|
||||
|
||||
def test_category_playlists_limit_high(self):
|
||||
response = self.spotify.categories()
|
||||
category = 'rock'
|
||||
for cat in response['categories']['items']:
|
||||
cat_id = cat['id']
|
||||
if cat_id == category:
|
||||
response = self.spotify.category_playlists(category_id=cat_id, limit=50)
|
||||
self.assertLessEqual(len(response['categories']['items']), 50)
|
||||
|
||||
|
||||
def test_new_releases(self):
|
||||
response = self.spotify.new_releases()
|
||||
self.assertGreater(len(response['albums']), 0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user