mirror of
https://github.com/c0de-archive/spotipy.git
synced 2025-07-30 14:00:18 +00:00
Add client credentials flow
This commit is contained in:
27
tests/client_credentials_tests.py
Normal file
27
tests/client_credentials_tests.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# -*- coding: latin-1 -*-
|
||||
|
||||
import spotipy
|
||||
from spotipy.oauth2 import SpotifyClientCredentials
|
||||
import unittest
|
||||
|
||||
'''
|
||||
Client Credentials Requests Tests
|
||||
'''
|
||||
|
||||
class ClientCredentialsTestSpotipy(unittest.TestCase):
|
||||
'''
|
||||
These tests require user authentication
|
||||
'''
|
||||
|
||||
muse_urn = 'spotify:artist:12Chz98pHFMPJEknJQMWvI'
|
||||
|
||||
def test_request_with_token(self):
|
||||
artist = spotify.artist(self.muse_urn)
|
||||
self.assertTrue(artist['name'] == u'Muse')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
spotify_cc = SpotifyClientCredentials()
|
||||
spotify = spotipy.Spotify(client_credentials_manager=spotify_cc)
|
||||
spotify.trace = False
|
||||
unittest.main()
|
Reference in New Issue
Block a user