def test_sets_types_parameter( web_client_mock, web_search_mock_large, provider, config, session_mock): web_client_mock.get.return_value = web_search_mock_large search.search( config['spotify'], session_mock, web_client_mock, {'any': ['ABBA']}, types=['album', 'artist']) web_client_mock.get.assert_called_once_with( 'https://api.spotify.com/v1/search', params={ 'q': '"ABBA"', 'limit': 50, 'type': 'album,artist'})
def test_sets_types_parameter(web_client_mock, web_search_mock_large, provider, config, session_mock): web_client_mock.get.return_value = web_search_mock_large search.search(config['spotify'], session_mock, web_client_mock, {'any': ['ABBA']}, types=['album', 'artist']) web_client_mock.get.assert_called_once_with( 'https://api.spotify.com/v1/search', params={ 'q': '"ABBA"', 'limit': 50, 'type': 'album,artist' })
def search(self, query=None, uris=None, exact=False): return search.search( self._config, self._backend._session, self._backend._web_client, query, uris, exact, )
def test_sets_types_parameter( web_search_mock_large, provider, config, session_mock): responses.add( responses.GET, 'https://api.spotify.com/v1/search', body=json.dumps(web_search_mock_large)) search.search( config['spotify'], session_mock, requests.Session(), {'any': ['ABBA']}, types=['album', 'artist']) assert len(responses.calls) == 1 uri_parts = sorted(re.split('[?&]', responses.calls[0].request.url)) assert (uri_parts == [ 'https://api.spotify.com/v1/search', 'limit=50', 'q=%22ABBA%22', 'type=album%2Cartist'])
def test_sets_types_parameter(web_client_mock, web_search_mock_large, provider, config, session_mock): web_client_mock.get.return_value = web_search_mock_large search.search( config["spotify"], session_mock, web_client_mock, {"any": ["ABBA"]}, types=["album", "artist"], ) web_client_mock.get.assert_called_once_with( "search", params={ "q": '"ABBA"', "limit": 50, "market": "from_token", "type": "album,artist", }, )
def _get_search( config, session, web_client, query, album=False, artist=False, track=False): types = [] if album: types.append('album') if artist: types.append('artist') if track: types.append('track') return search.search( config, session, web_client, query, types=types)
def _get_search( config, session, requests_session, query, album=False, artist=False, track=False): types = [] if album: types.append('album') if artist: types.append('artist') if track: types.append('track') return search.search( config, session, requests_session, query, types=types)
def _get_search(config, session, web_client, query, album=False, artist=False, track=False): types = [] if album: types.append("album") if artist: types.append("artist") if track: types.append("track") return search.search(config, session, web_client, query, types=types)
def search(self, query=None, uris=None, exact=False): return search.search( self._config, self._backend._session, self._requests_session, query, uris, exact)