Ejemplo n.º 1
0
def test_artwork_generator():
    """Generates several tests posters/backdrops

    Uses test generator to prevent multiple requests for the movie info
    """
    filmId = tmdb.MovieDb().search("Fight Club")[0]['id']
    film = tmdb.MovieDb().getMovieInfo(filmId)

    def test_poster_urls():
        """Checks posters are valid looking URLs
        """
        for poster in film['images'].posters:
            for key, value in poster.items():
                if key not in ['id', 'type']:
                    assert value.startswith("http://")

    yield test_poster_urls

    def test_backdrop_urls():
        """Checks backdrop images are valid looking URLs
        """
        for poster in film['images'].posters:
            for key, value in poster.items():
                if key not in ['id', 'type']:
                    assert value.startswith("http://")

    yield test_backdrop_urls

    def test_artwork_repr():
        """Checks artwork repr looks sensible
        """
        poster_repr = repr(film['images'].posters[0])
        assert poster_repr.startswith("<Image (poster for ID")

        backdrop_repr = repr(film['images'].backdrops[0])
        assert backdrop_repr.startswith("<Image (backdrop for ID")

    yield test_artwork_repr

    def test_posters():
        """Check retrieving largest artwork
        """
        assert len(film['images'].posters) > 1
        assert len(film['images'].backdrops) > 1
        print(film['images'].posters[0]['cover'])
        url = film['images'].posters[0]['cover']
        assert url.startswith('http://')
        assert url.endswith('.jpg')

    yield test_posters
Ejemplo n.º 2
0
def test_simple_search():
    """Simple test search
    """
    t = tmdb.MovieDb()
    sr = t.search("Fight Club")
    assert isinstance(sr, tmdb.SearchResults)
    assert sr[0]['name'] == "Fight Club"
Ejemplo n.º 3
0
def test_castthumbnails():
    """Tests actors have thumbnails
    """
    t = tmdb.MovieDb()
    film = t.getMovieInfo(950)
    assert 'thumb' in film['cast']['actor'][0]
    assert film['cast']['actor'][0]['thumb'].startswith('http://')
Ejemplo n.º 4
0
def test_info_from_search():
    """Get info from first search result
    """
    t = tmdb.MovieDb()
    results = t.search("Fight Club")
    first_result = results[0]
    info = first_result.info()
    assert info['name'] == "Fight Club"
Ejemplo n.º 5
0
def test_mediagetinfo():
    """Tests searching by file hash
    """
    t = tmdb.MovieDb()
    films = t.mediaGetInfo(hash = '907172e7fe51ba57', size = 742086656)
    film = films[0]
    print film['name']
    assert film['name'] == 'Sin City'
Ejemplo n.º 6
0
def test_mediagetinfo():
    """Tests searching by file hash
    """

    import nose
    raise nose.SkipTest("Finding reliable hash to test with is difficult..")

    t = tmdb.MovieDb()
    films = t.mediaGetInfo(hash='907172e7fe51ba57', size=742086656)
    film = films[0]
    print(film['name'])
    assert film['name'] == 'Sin City'
Ejemplo n.º 7
0
def test_search_results():
    """Check SearchResults are usable
    """
    t = tmdb.MovieDb()
    results = t.search("Fight Club")
    first_result = results[0]

    assert isinstance(first_result, tmdb.MovieResult)

    assert first_result['name'] == 'Fight Club'

    assert first_result['released'] == '1999-09-16'

    assert first_result['imdb_id'] == 'tt0137523'
Ejemplo n.º 8
0
 def __init__(self):
     NoOpFanartProvider.__init__(self)        
     tmdb.config['apikey'] = '4956f64b34ac586d01d6820de8e93d58'
     self.mdb = tmdb.MovieDb()
Ejemplo n.º 9
0
 def setUp(self):
     filmId = tmdb.MovieDb().search("Fight Club")[0]['id']
     self.film = tmdb.MovieDb().getMovieInfo(filmId)
Ejemplo n.º 10
0
 def setUp(self):
     self.m = tmdb.MovieDb()
Ejemplo n.º 11
0
 def __init__(self, nextProvider=None):
     BaseFanartProvider.__init__(self, nextProvider)
     tmdb.config['apikey'] = '4956f64b34ac586d01d6820de8e93d58'
     self.mdb = tmdb.MovieDb()