Beispiel #1
0
    def test_get_album_id_does_not_exist(self):
        """Test that an album that does not exist returns None"""
        dao = mock.Mock(spec=avalon.models.ReadOnlyDao)
        dao.get_all_albums.return_value = []
        dao.get_all_artists.return_value = []
        dao.get_all_genres.return_value = []

        cache = avalon.cache.IdLookupCache(dao).reload()
        assert None is cache.get_album_id('Dookie')
Beispiel #2
0
    def test_get_album_id_case_insensitive(self):
        """Test that we can translate an album name to ID in a case insensitive fasion"""
        model1 = avalon.models.Album()
        model1.id = uuid.UUID("2d24515c-a459-552a-b022-e85d1621425a")
        model1.name = 'Dookie'

        dao = mock.Mock(spec=avalon.models.ReadOnlyDao)
        dao.get_all_albums.return_value = [model1]
        dao.get_all_artists.return_value = []
        dao.get_all_genres.return_value = []

        cache = avalon.cache.IdLookupCache(dao).reload()

        assert uuid.UUID("2d24515c-a459-552a-b022-e85d1621425a") == \
               cache.get_album_id('DOOKIE')