Beispiel #1
0
    def test_parser(self, site_mock, base_init_mock, browser_mock, json_mock, progress_print_mock):  # pylint: disable=too-many-arguments
        json_mock.return_value = self.my_ratings
        parser = FlixsterRatingsParser(None)
        parser.args = False
        parser.movies = []
        parser.site = site_mock
        parser.site.site_name = 'Flixster'
        parser.site.browser = browser_mock

        parser.parse()

        self.assertEqual(330 - 9, len(parser.movies))
        self.assertEqual(dict, type(parser.movies[0]))
        self.assertEqual('Fight Club', parser.movies[0]['title'])
        self.assertEqual(1999, parser.movies[0]['year'])

        self.assertEqual(13153, parser.movies[0]['flixster']['id'])
        self.assertEqual('http://www.flixster.com/movie/fight-club/', parser.movies[0]['flixster']['url'])
        self.assertEqual(10, parser.movies[0]['flixster']['my_rating'])
Beispiel #2
0
    def test_parser(self, site_mock, base_init_mock, browser_mock, json_mock,
                    progress_print_mock):  # pylint: disable=too-many-arguments
        json_mock.return_value = self.my_ratings
        parser = FlixsterRatingsParser(None)
        parser.args = False
        parser.movies = []
        parser.site = site_mock
        parser.site.site_name = "Flixster"
        parser.site.browser = browser_mock

        parser.parse()

        self.assertEqual(330 - 9, len(parser.movies))
        self.assertEqual(dict, type(parser.movies[0]))
        self.assertEqual("Fight Club", parser.movies[0]["title"])
        self.assertEqual(1999, parser.movies[0]["year"])

        self.assertEqual(13153, parser.movies[0]["flixster"]["id"])
        self.assertEqual(
            "https://www.flixster.com/movie/fight-club/",
            parser.movies[0]["flixster"]["url"],
        )
        self.assertEqual(10, parser.movies[0]["flixster"]["my_rating"])
Beispiel #3
0
    def test_init(self, browser_mock, base_init_mock):
        FlixsterRatingsParser(None)

        self.assertTrue(base_init_mock.called)