def test_get_movie_info_no_votes(): crit_scraper = CritickerScraper() with requests_mock.mock() as m: m.get('https://www.criticker.com/film/16-Fathoms-Deep/', text=read_file('test/fixtures/criticker-16-fathoms-deep.html')) movie_info = crit_scraper.get_movie_info( 'https://www.criticker.com/film/16-Fathoms-Deep/') assert movie_info.get('crit_votes') == 0
def test_get_movie_info_no_poster(): crit_scraper = CritickerScraper() with requests_mock.mock() as m: m.get('https://www.criticker.com/film/8-Tire-on-the-Ice/', text=read_file('test/fixtures/criticker-8-tire-on-the-ice.html')) movie_info = crit_scraper.get_movie_info( 'https://www.criticker.com/film/8-Tire-on-the-Ice/') assert movie_info.get('poster_url') is None
def test_get_movie_info_no_trailer(): crit_scraper = CritickerScraper() with requests_mock.mock() as m: m.get('http://www.criticker.com/film/Daens/', text=read_file('test/fixtures/criticker-daens.html')) movie_info = crit_scraper.get_movie_info( 'http://www.criticker.com/film/Daens/') assert movie_info['trailer_url'] is None
def test_get_movie_info_no_rating_of_my_own(): crit_scraper = CritickerScraper() with requests_mock.mock() as m: m.get('http://www.criticker.com/film/The-Mask/', text=read_file('test/fixtures/criticker-the-mask.html')) movie_info = crit_scraper.get_movie_info( 'http://www.criticker.com/film/The-Mask/') assert movie_info['my_ratings']['tijl'].get('rating') is None
def test_get_movie_info(): crit_scraper = CritickerScraper() with requests_mock.mock() as m: m.get('http://www.criticker.com/film/The-Matrix/', text=read_file('test/fixtures/criticker-the-matrix.html')) movie_info = crit_scraper.get_movie_info( 'http://www.criticker.com/film/The-Matrix/') assert movie_info[ 'poster_url'] == 'https://www.criticker.com/img/films/posters/The-Matrix.jpg' assert movie_info['imdbid'] == 133093 assert movie_info['crit_rating'] == pytest.approx(7.71, 0.3) assert movie_info['crit_votes'] == pytest.approx(27493, 1000) assert movie_info['my_ratings']['tijl']['rating'] == 93 assert movie_info['my_ratings']['tijl']['psi'] == pytest.approx(80, 10) assert movie_info[ 'trailer_url'] == 'https://www.youtube.com/watch?v=vKQi3bBA1y8'