Beispiel #1
0
    def test_specifying_pos_args_until_limit(self, app_token):
        client = Spotify(app_token, max_limits_on=True)
        s1, = client.search('piano', ('track', ), None, None)
        with client.max_limits(False):
            s2, = client.search('piano', ('track', ), None, None)

        assert s1.limit > s2.limit
        client.close()
Beispiel #2
0
    def test_turning_off_max_limits_returns_less(self, app_token):
        client = Spotify(app_token, max_limits_on=True)
        s1, = client.search('piano')
        with client.max_limits(False):
            s2, = client.search('piano')

        assert s1.limit > s2.limit
        client.close()
Beispiel #3
0
    def test_turning_on_max_limits_returns_more(self, app_token):
        client = Spotify(app_token)
        s1, = client.search('piano')
        with client.max_limits(True):
            s2, = client.search('piano')

        assert s1.limit < s2.limit
        client.close()
Beispiel #4
0
 def test_request_with_closed_client_raises(self):
     client = Spotify()
     client.close()
     with pytest.raises(RuntimeError):
         client.track('id')
Beispiel #5
0
 def test_chunked_context_disables(self):
     client = Spotify(chunked_on=True)
     with client.chunked(False):
         assert client.chunked_on is False
     client.close()
Beispiel #6
0
 def test_chunked_context_enables(self):
     client = Spotify()
     with client.chunked(True):
         assert client.chunked_on is True
     client.close()
Beispiel #7
0
 def test_returns_model_list(self, app_token, track_ids):
     client = Spotify(app_token, chunked_on=True)
     tracks = client.tracks(track_ids)
     assert isinstance(tracks, ModelList)
     client.close()
Beispiel #8
0
 def test_too_many_chunked_succeeds(self, app_token, track_ids):
     client = Spotify(app_token, chunked_on=True)
     tracks = client.tracks(track_ids)
     assert len(track_ids) == len(tracks)
     client.close()
Beispiel #9
0
    def test_specifying_limit_pos_arg_overrides_max_limits(self, app_token):
        client = Spotify(app_token, max_limits_on=True)
        s, = client.search('piano', ('track', ), None, None, 1)

        assert s.limit == 1
        client.close()
Beispiel #10
0
    def test_specifying_limit_kwarg_overrides_max_limits(self, app_token):
        client = Spotify(app_token, max_limits_on=True)
        s, = client.search('piano', limit=1)

        assert s.limit == 1
        client.close()