def test_target_movie_detail_page_has_no_year( self, browser_mock, base_init_mock, site_mock ): # pylint: disable=too-many-arguments with open( os.path.join( TESTDATA_PATH, "listal", "movie_details_page_without_release_year.html" ), encoding="UTF-8", ) as movie_details_page_without_release_year: movie_details_page_without_release_year = ( movie_details_page_without_release_year.read() ) site_mock.browser = browser_mock browser_mock.page_source = movie_details_page_without_release_year inserter = ListalRatingsInserter(None) inserter.site = site_mock inserter.site.site_name = "Listal" inserter.failed_movies = [] inserter.args = None movie2 = dict() movie2["title"] = "Fight Club" movie2["year"] = 1999 search_result = BeautifulSoup(self.search_result_tile_list[0], "html.parser") result = inserter._is_requested_movie( movie2, search_result ) # pylint: disable=protected-access self.assertFalse(result)
def test_compare_fail_by_year(self, browser_mock, base_init_mock, site_mock): # pylint: disable=too-many-arguments site_mock.browser = browser_mock browser_mock.page_source = self.movie_details_page inserter = ListalRatingsInserter(None) inserter.site = site_mock inserter.site.site_name = 'Listal' inserter.failed_movies = [] movie2 = dict() movie2['title'] = 'The Matrix' movie2['year'] = 1995 search_result = BeautifulSoup(self.search_result_tile_list[0], 'html.parser') result = inserter._is_requested_movie(movie2, search_result) # pylint: disable=protected-access self.assertFalse(result)
def test_compare_success_by_year( self, browser_mock, base_init_mock, site_mock ): # pylint: disable=too-many-arguments site_mock.browser = browser_mock browser_mock.page_source = self.movie_details_page inserter = ListalRatingsInserter(None) inserter.site = site_mock inserter.site.site_name = "Listal" inserter.failed_movies = [] movie2 = dict() movie2["title"] = "Fight Club" movie2["year"] = 1999 search_result = BeautifulSoup(self.search_result_tile_list[0], "html.parser") result = inserter._is_requested_movie( movie2, search_result ) # pylint: disable=protected-access self.assertTrue(result)
def test_compare_success_by_imdb(self, browser_mock, base_init_mock, site_mock): # pylint: disable=too-many-arguments site_mock.browser = browser_mock browser_mock.page_source = self.movie_details_page inserter = ListalRatingsInserter(None) inserter.site = site_mock inserter.site.site_name = 'Listal' inserter.failed_movies = [] movie2 = dict() movie2['title'] = 'Fight Club' movie2['year'] = 1998 movie2['imdb'] = dict() movie2['imdb']['id'] = 'tt0137523' movie2['imdb']['url'] = 'http://www.imdb.com/title/tt0137523' movie2['imdb']['my_rating'] = 9 search_result = BeautifulSoup(self.search_result_tile_list[0], 'html.parser') result = inserter._is_requested_movie(movie2, search_result) # pylint: disable=protected-access self.assertTrue(result)