mirror of
https://github.com/c0de-archive/spotipy.git
synced 2025-07-30 14:00:18 +00:00
Added timeout test
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import spotipy
|
||||
import unittest
|
||||
import pprint
|
||||
import requests
|
||||
from spotipy.client import SpotifyException
|
||||
|
||||
|
||||
@@ -105,6 +106,15 @@ class TestSpotipy(unittest.TestCase):
|
||||
|
||||
self.assertTrue(found)
|
||||
|
||||
def test_search_timeout(self):
|
||||
sp = spotipy.Spotify(requests_timeout=.1)
|
||||
try:
|
||||
results = sp.search(q='my*', type='track')
|
||||
self.assertTrue(False, 'unexpected search timeout')
|
||||
except requests.ReadTimeout:
|
||||
self.assertTrue(True, 'expected search timeout')
|
||||
|
||||
|
||||
def test_album_search(self):
|
||||
results = self.spotify.search(q='weezer pinkerton', type='album')
|
||||
self.assertTrue('albums' in results)
|
||||
|
Reference in New Issue
Block a user