Exemple #1
0
 def test_totally_invalid(self):
     with pytest.raises(ConversionError):
         from_uri('not-a-valid-uri')
Exemple #2
0
 def test_invalid_type(self):
     with pytest.raises(ConversionError):
         from_uri('spotify:invalid:b62')
Exemple #3
0
 def test_invalid_prefix(self):
     with pytest.raises(ConversionError):
         from_uri('youtube:track:b62')
Exemple #4
0
 def test_invalid_id(self):
     with pytest.raises(ConversionError):
         from_uri('spotify:track:n_b62')
Exemple #5
0
 def test_valid(self):
     t, i = from_uri('spotify:track:b62')
     assert t == 'track' and i == 'b62'
Exemple #6
0
 def test_user_non_b62(self):
     t, i = from_uri('spotify:user:a#a')
     assert t == 'user' and i == 'a#a'
Exemple #7
0
 def _call(uri, type_, id_) -> bool:
     t, i = from_uri(uri)
     return t == type_ and i == id_
Exemple #8
0
 def get_track_preview(self, uri):
     id = tekore.from_uri(uri)[1]
     return self.spotify_client.track(id).preview_url