Beispiel #1
0
    def test_without_name_uses_uri(self, web_album_mock):
        del web_album_mock["name"]

        ref = translator.web_to_album_ref(web_album_mock)

        assert ref.name == "spotify:album:def"
Beispiel #2
0
    def test_returns_none_if_wrong_type(self, web_album_mock):
        web_album_mock["type"] = "playlist"

        assert translator.web_to_album_ref(web_album_mock) is None
Beispiel #3
0
    def test_successful_translation(self, web_album_mock):
        ref = translator.web_to_album_ref(web_album_mock)

        assert ref.type == models.Ref.ALBUM
        assert ref.uri == "spotify:album:def"
        assert ref.name == "DEF 456"
Beispiel #4
0
 def test_returns_none_if_invalid(self, web_album_mock):
     with patch.object(translator, "valid_web_data", return_value=False):
         assert translator.web_to_album_ref(web_album_mock) is None