示例#1
0
    def test_caches_results(self, sp_album_mock):
        ref1 = translator.to_album_ref(sp_album_mock)
        ref2 = translator.to_album_ref(sp_album_mock)

        assert ref1 is ref2
示例#2
0
    def test_if_artist_is_none(self, sp_album_mock):
        sp_album_mock.artist = None

        ref = translator.to_album_ref(sp_album_mock)

        assert ref.name == 'DEF 456'
示例#3
0
    def test_if_artist_is_not_loaded(self, sp_album_mock):
        sp_album_mock.artist.is_loaded = False

        ref = translator.to_album_ref(sp_album_mock)

        assert ref.name == 'DEF 456'
示例#4
0
    def test_returns_none_if_unloaded(self, sp_album_mock):
        sp_album_mock.is_loaded = False

        ref = translator.to_album_ref(sp_album_mock)

        assert ref is None
示例#5
0
    def test_successful_translation(self, sp_album_mock):
        ref = translator.to_album_ref(sp_album_mock)

        assert ref.type == 'album'
        assert ref.uri == 'spotify:album:def'
        assert ref.name == 'ABBA - DEF 456'
示例#6
0
    def test_caches_results(self, sp_album_mock):
        ref1 = translator.to_album_ref(sp_album_mock)
        ref2 = translator.to_album_ref(sp_album_mock)

        assert ref1 is ref2
示例#7
0
    def test_if_artist_is_not_loaded(self, sp_album_mock):
        sp_album_mock.artist.is_loaded = False

        ref = translator.to_album_ref(sp_album_mock)

        assert ref.name == 'DEF 456'
示例#8
0
    def test_if_artist_is_none(self, sp_album_mock):
        sp_album_mock.artist = None

        ref = translator.to_album_ref(sp_album_mock)

        assert ref.name == 'DEF 456'
示例#9
0
    def test_successful_translation(self, sp_album_mock):
        ref = translator.to_album_ref(sp_album_mock)

        assert ref.type == 'album'
        assert ref.uri == 'spotify:album:def'
        assert ref.name == 'ABBA - DEF 456'
示例#10
0
    def test_returns_none_if_unloaded(self, sp_album_mock):
        sp_album_mock.is_loaded = False

        ref = translator.to_album_ref(sp_album_mock)

        assert ref is None