Example #1
0
    def test_parser_single_movie_with_missing_imdb_id(self, site_mock, base_init_mock, browser_mock):
        browser_mock.page_source = self.my_ratings
        parser = TraktRatingsParser(None)
        parser.movies = []
        parser.site = site_mock
        parser.site.site_name = 'Trakt'
        parser.site.browser = browser_mock
        browser_mock.page_source = self.detail_page_without_imdb_id
        movie = dict()

        parser.parse_movie_details_page(movie)

        # Top Gear Patagonia
        self.assertEqual(2014, movie['year'])
        self.assertNotIn('imdb', movie)
        self.assertEqual('314390', movie['tmdb']['id'])
        self.assertEqual('https://www.themoviedb.org/movie/314390', movie['tmdb']['url'])
        self.assertEqual(8, movie['trakt']['my_rating'])
Example #2
0
    def test_parser_single_movie(self, site_mock, base_init_mock, browser_mock):
        browser_mock.page_source = self.my_ratings
        parser = TraktRatingsParser(None)
        parser.movies = []
        parser.site = site_mock
        parser.site.site_name = 'Trakt'
        parser.site.browser = browser_mock
        browser_mock.page_source = self.detail_page
        movie = dict()

        parser.parse_movie_details_page(movie)

        # Fight Club
        self.assertEqual(1999, movie['year'])
        self.assertEqual('tt0137523', movie['imdb']['id'])
        self.assertEqual('http://www.imdb.com/title/tt0137523', movie['imdb']['url'])
        self.assertEqual('550', movie['tmdb']['id'])
        self.assertEqual('https://www.themoviedb.org/movie/550', movie['tmdb']['url'])
        self.assertEqual(10, movie['trakt']['my_rating'])
Example #3
0
    def test_parser_single_movie_with_missing_imdb_id(self, site_mock,
                                                      base_init_mock,
                                                      browser_mock):
        browser_mock.page_source = self.my_ratings
        parser = TraktRatingsParser(None)
        parser.movies = []
        parser.site = site_mock
        parser.site.site_name = "Trakt"
        parser.site.browser = browser_mock
        browser_mock.page_source = self.detail_page_without_imdb_id
        movie = dict()

        parser.parse_movie_details_page(movie)

        # Top Gear Patagonia
        self.assertEqual(2014, movie["year"])
        self.assertNotIn("imdb", movie)
        self.assertEqual("314390", movie["tmdb"]["id"])
        self.assertEqual("https://www.themoviedb.org/movie/314390",
                         movie["tmdb"]["url"])
        self.assertEqual(8, movie["trakt"]["my_rating"])
Example #4
0
    def test_parser_single_movie(self, site_mock, base_init_mock,
                                 browser_mock):
        browser_mock.page_source = self.my_ratings
        parser = TraktRatingsParser(None)
        parser.movies = []
        parser.site = site_mock
        parser.site.site_name = "Trakt"
        parser.site.browser = browser_mock
        browser_mock.page_source = self.detail_page
        movie = dict()

        parser.parse_movie_details_page(movie)

        # Fight Club
        self.assertEqual(1999, movie["year"])
        self.assertEqual("tt0137523", movie["imdb"]["id"])
        self.assertEqual("https://www.imdb.com/title/tt0137523",
                         movie["imdb"]["url"])
        self.assertEqual("550", movie["tmdb"]["id"])
        self.assertEqual("https://www.themoviedb.org/movie/550",
                         movie["tmdb"]["url"])
        self.assertEqual(10, movie["trakt"]["my_rating"])