cast filterObject as list

and change request timeout
This commit is contained in:
Harrison authored and Stephane Bruckert committed 2020-01-11 19:56:32 +00:00
1 parent eec44550fc
commit 62277ac0a8
2 files changed
+6 -4

No files matched your search

+4 -2
View File
@@ -62,7 +62,7 @@ class AuthTestSpotipy(unittest.TestCase):
@classmethod @classmethod
def setUpClass(self): def setUpClass(self):
missing = filter(lambda var: not os.getenv(CCEV[var]), CCEV) missing = list(filter(lambda var: not os.getenv(CCEV[var]), CCEV))
if missing: if missing:
raise Exception('Please set the client credentials for the test application using the following environment variables: {}'.format(CCEV.values())) raise Exception('Please set the client credentials for the test application using the following environment variables: {}'.format(CCEV.values()))
@@ -175,7 +175,9 @@ class AuthTestSpotipy(unittest.TestCase):
for cat in response['categories']['items']: for cat in response['categories']['items']:
cat_id = cat['id'] cat_id = cat['id']
response = self.spotify.category_playlists(category_id=cat_id) response = self.spotify.category_playlists(category_id=cat_id)
self.assertTrue(len(response['playlists']["items"]) > 0) if len(response['playlists']["items"]) > 0:
break
self.assertTrue(True)
def test_new_releases(self): def test_new_releases(self):
response = self.spotify.new_releases() response = self.spotify.new_releases()
+2 -2
View File
@@ -47,7 +47,7 @@ class TestSpotipy(unittest.TestCase):
@classmethod @classmethod
def setUpClass(self): def setUpClass(self):
missing = filter(lambda var: not os.getenv(CCEV[var]), CCEV) missing = list(filter(lambda var: not os.getenv(CCEV[var]), CCEV))
if missing: if missing:
raise Exception('Please set the client credentials for the test application using the following environment variables: {}'.format(CCEV.values())) raise Exception('Please set the client credentials for the test application using the following environment variables: {}'.format(CCEV.values()))
@@ -156,7 +156,7 @@ class TestSpotipy(unittest.TestCase):
self.assertTrue(found) self.assertTrue(found)
def test_search_timeout(self): def test_search_timeout(self):
sp = Spotify(auth=self.token, requests_timeout=.1) sp = Spotify(auth=self.token, requests_timeout=.01)
try: try:
results = sp.search(q='my*', type='track') results = sp.search(q='my*', type='track')
self.assertTrue(False, 'unexpected search timeout') self.assertTrue(False, 'unexpected search timeout')