Ejemplo n.º 1
0
 def test_verify_params__acceptable_emotions(self):
     try:
         irrelevant_acceptable_limit = 10
         emotions = {"arbitrary-key": 0.0}
         SpotifyClient._verify_params(emotions, irrelevant_acceptable_limit)
     except BadRequest:
         self.fail("Should not throw exception for non-empty emotions")
Ejemplo n.º 2
0
 def test_verify_params__faulty_limit(self, limit):
     try:
         SpotifyClient._verify_params({"irrelevant": 0.0}, limit)
     except BadRequest as e:
         assert e.code == 400
         assert e.description == "The limit param has to be between " \
                                 "1 and 100"
Ejemplo n.º 3
0
 def test_verify_params__missing_emotions(self):
     try:
         irrelevant_acceptable_limit = 10
         empty_emotions = {}
         SpotifyClient._verify_params(
             empty_emotions, irrelevant_acceptable_limit)
     except BadRequest as e:
         assert e.code == 400
         assert e.description == "No emotions dict sent"
Ejemplo n.º 4
0
 def test_get_uri(self, value):
     track: Track = {
         "arbitrary-key-1": "arbitrary-value-1",
         "arbitrary-key-2": "arbitrary-value-2",
         "uri": value,
     }
     actual = SpotifyClient._get_uri(track)
     expected = {"uri": value}
     assert actual == expected
Ejemplo n.º 5
0
 def test_verify_params__acceptable_limit(self, limit):
     try:
         SpotifyClient._verify_params({"irrelevant": 0.0}, limit)
     except BadRequest:
         self.fail("Should not throw exception for limit %s" % limit)
Ejemplo n.º 6
0
def _spotify_client():
    return SpotifyClient(EmotionClient("irrelevant-sub-key"))
Ejemplo n.º 7
0
def _spotify_client(requester=None):
    return SpotifyClient(requester, EmotionClient(None, "irrelevant-sub-key"),
                         "irrelevant-token")
Ejemplo n.º 8
0
def _spotify_client(token) -> SpotifyClient:
    return SpotifyClient(
        requests,
        _emotion_client(),
        token)