fixed failing test (#68)
This commit is contained in:
@@ -11,9 +11,11 @@ __all__ = [
|
|||||||
'open_tidal_session'
|
'open_tidal_session'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
SPOTIFY_SCOPES = 'playlist-read-private, user-library-read'
|
||||||
|
|
||||||
def open_spotify_session(config) -> spotipy.Spotify:
|
def open_spotify_session(config) -> spotipy.Spotify:
|
||||||
credentials_manager = spotipy.SpotifyOAuth(username=config['username'],
|
credentials_manager = spotipy.SpotifyOAuth(username=config['username'],
|
||||||
scope='playlist-read-private, user-library-read',
|
scope=SPOTIFY_SCOPES,
|
||||||
client_id=config['client_id'],
|
client_id=config['client_id'],
|
||||||
client_secret=config['client_secret'],
|
client_secret=config['client_secret'],
|
||||||
redirect_uri=config['redirect_uri'],
|
redirect_uri=config['redirect_uri'],
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import tidalapi
|
|||||||
import yaml
|
import yaml
|
||||||
import sys
|
import sys
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from spotify_to_tidal.auth import open_spotify_session, open_tidal_session
|
from spotify_to_tidal.auth import open_spotify_session, open_tidal_session, SPOTIFY_SCOPES
|
||||||
|
|
||||||
|
|
||||||
def test_open_spotify_session(mocker):
|
def test_open_spotify_session(mocker):
|
||||||
@@ -36,7 +36,7 @@ def test_open_spotify_session(mocker):
|
|||||||
# Assert that the SpotifyOAuth was called with correct parameters
|
# Assert that the SpotifyOAuth was called with correct parameters
|
||||||
mock_spotify_oauth.assert_called_once_with(
|
mock_spotify_oauth.assert_called_once_with(
|
||||||
username="test_user",
|
username="test_user",
|
||||||
scope="playlist-read-private",
|
scope=SPOTIFY_SCOPES,
|
||||||
client_id="test_client_id",
|
client_id="test_client_id",
|
||||||
client_secret="test_client_secret",
|
client_secret="test_client_secret",
|
||||||
redirect_uri="http://localhost/",
|
redirect_uri="http://localhost/",
|
||||||
@@ -70,4 +70,4 @@ def test_open_spotify_session_oauth_error(mocker):
|
|||||||
|
|
||||||
# Call the function under test and assert sys.exit is called
|
# Call the function under test and assert sys.exit is called
|
||||||
open_spotify_session(mock_config)
|
open_spotify_session(mock_config)
|
||||||
mock_sys_exit.assert_called_once()
|
mock_sys_exit.assert_called_once()
|
||||||
|
|||||||
Reference in New Issue
Block a user