mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-10-12 09:10:45 +00:00
Refactor SpotifyOauthError class
- add error and error description to SpotifyOauthError to reflect the data returned by web api when error happens - unit test to SpotifyClientCredentials.get_access_token is added for invalid client
This commit is contained in:
1 parent
5c981a1d62
commit
901b2031a2
2 files changed
+23
-3
No files matched your search
@@ -6,6 +6,7 @@ import unittest
|
||||
import six.moves.urllib.parse as urllibparse
|
||||
|
||||
from spotipy import SpotifyOAuth
|
||||
from spotipy.oauth2 import SpotifyClientCredentials, SpotifyOauthError
|
||||
|
||||
try:
|
||||
import unittest.mock as mock
|
||||
@@ -166,3 +167,9 @@ class TestSpotifyOAuth(unittest.TestCase):
|
||||
parsed_url = urllibparse.urlparse(url)
|
||||
parsed_qs = urllibparse.parse_qs(parsed_url.query)
|
||||
self.assertTrue(parsed_qs['show_dialog'])
|
||||
|
||||
def test_spotify_client_credentials_get_access_token(self):
|
||||
oauth = SpotifyClientCredentials(client_id='ID', client_secret='SECRET')
|
||||
with self.assertRaises(SpotifyOauthError) as error:
|
||||
oauth.get_access_token()
|
||||
self.assertEqual(error.exception.error, 'invalid_client')
|
||||
Reference in new issue
Block a user