Example #1
0
def test_parse_store_load_persons():
    create_test_tables()
    db = MySQLDatabase(schema='qmdb_test', env='test')
    imdb_scraper = IMDBScraper()
    imdbid = '3315342'
    movie_info = imdb_scraper.process_main_info(imdbid)
    movie_info.update({
        'crit_id': 1234,
        'title': 'Logan',
        'year': 2017,
        'crit_url': 'http://www.criticker.com/film/Logan/',
        'date_added': '2018-01-01'
    })
    movie = Movie(movie_info)
    db.set_movie(movie)
    db = MySQLDatabase(schema='qmdb_test', env='test')
    assert db.movies[1234].cast[0]['name'] == 'Hugh Jackman'
    assert db.movies[1234].director[0]['name'] == 'James Mangold'
    assert db.movies[1234].writer[1]['name'] == 'Scott Frank'
Example #2
0
def test_process_main_info():
    imdb_scraper = IMDBScraper()
    info = imdb_scraper.process_main_info('0133093')
    assert isinstance(info, dict)
    assert info['imdb_year'] == 1999
    assert info['kind'] == 'movie'
    assert info['cast'][0]['name'] == 'Keanu Reeves'
    assert len(info['cast']) == 39
    assert info['director'][0]['name'] == 'Lana Wachowski'
    assert len(info['director']) == 2
    assert info['writer'][0]['name'] == 'Lilly Wachowski'
    assert len(info['writer']) == 2
    assert info['genres'] == ['Action', 'Sci-Fi']
    assert info['runtime'] == 136
    assert info['countries'] == ['United States']
    assert info['imdb_rating'] == 8.7
    assert info['imdb_votes'] == 1379790
    assert info['plot_storyline'][:10] == 'Thomas A. '
    assert info['languages'] == ['English']