Esempio n. 1
0
 def test_add_authors_to_movie(self):
     imdb_person = ImdbPersonFactory(id=234502)  # writer, Dostoevskiy
     imdb_movie = ImdbMovieFactory(id=475730)
     imdb_movie.sync(roles=True)
     self.assertTrue(
         imdb_movie.movie.cast.get(person=imdb_person.person,
                                   role=self.author))
Esempio n. 2
0
 def test_add_roles_to_movie_by_names(self):
     person1 = PersonFactory(first_name_en='Lilly',
                             last_name_en='Wachowski')
     person2 = PersonFactory(first_name_en='Keanu', last_name_en='Reeves')
     person3 = PersonFactory(first_name_en='Jeremy', last_name_en='Ball')
     imdb_movie = ImdbMovieFactory(id=133093)
     imdb_movie.sync(roles=True)
     self.assert_matrix_cast(imdb_movie, person1, person2, person3)
Esempio n. 3
0
 def test_add_roles_to_movie_by_imdb_id(self):
     imdb_person1 = ImdbPersonFactory(
         id=905152)  # Lilly Wachowski: director, scenarist, producer
     imdb_person2 = ImdbPersonFactory(id=206)  # Keanu Reeves: Neo
     imdb_person3 = ImdbPersonFactory(id=50390)  # Jeremy Ball: Businessman
     imdb_movie = ImdbMovieFactory(id=133093)
     imdb_movie.sync(roles=True)
     self.assert_matrix_cast(imdb_movie, imdb_person1.person,
                             imdb_person2.person, imdb_person3.person)
Esempio n. 4
0
 def test_movie_exists_genres_adams_family(self):
     imdb_movie = ImdbMovieFactory(id=57729, movie__genres=[])
     imdb_movie.movie.genres.set(
         [Genre.BLACK_AND_WHITE_ID, Genre.DOCUMENTARY_ID])
     self.assertQuerysetEqual(imdb_movie.movie.genres.all(),
                              ['Black and white', 'Documentary'])
     imdb_movie.sync()
     self.assertQuerysetEqual(imdb_movie.movie.genres.all(), [
         'Black and white', 'Comedy', 'Documentary', 'Family', 'Horror',
         'Series'
     ])
Esempio n. 5
0
 def test_add_imdb_id_to_persons_of_movie(self):
     imdb_movie = ImdbMovieFactory(id=133093)
     cast1 = CastFactory(movie=imdb_movie.movie,
                         person__first_name_en='Lilly',
                         person__last_name_en='Wachowski',
                         role=self.director)
     cast2 = CastFactory(movie=imdb_movie.movie,
                         person__first_name_en='Keanu',
                         person__last_name_en='Reeves',
                         role=self.actor)
     cast3 = CastFactory(movie=imdb_movie.movie,
                         person__first_name_en='Jeremy',
                         person__last_name_en='Ball',
                         role=self.actor)
     imdb_movie.sync(roles=True)
     self.assert_matrix_cast(imdb_movie, cast1.person, cast2.person,
                             cast3.person)
Esempio n. 6
0
    def test_sync_all_roles_of_ru_movie_from_imdb_and_kinopoisk(self):
        imdb_movie = ImdbMovieFactory(id=69293)  # solaris
        movie = imdb_movie.movie
        kp_movie = KinopoiskMovieFactory(id=43911, movie=movie)

        kp_movie.sync(roles='all')
        self.assertEqual(movie.cast.count(), 28)
        self.assertEqual(Person.objects.count(), 27)

        imdb_movie.sync(roles='all')
        self.assertEqual(movie.cast.count(), 39)
        self.assertEqual(Person.objects.count(), 37)

        self.assertEqual(
            Person.objects.exclude(kinopoisk=None).exclude(imdb=None).count(),
            18)  # found by translit
        self.assertEqual(Person.objects.filter(kinopoisk=None).count(), 10)
        self.assertEqual(Person.objects.filter(imdb=None).count(), 9)
        self.assertListEqual(
            [p.name for p in Person.objects.filter(kinopoisk=None)], [
                'Andrei Tarkovsky', 'Jüri Järvet', 'Sos Sargsyan',
                'Yulian Semyonov', 'Raimundas Banionis', 'Artyom Karapetyan',
                'Vladimir Tatosov', 'Vladimir Zamanskiy', 'Nina Marcus',
                'Stanislaw Lem'
            ])
        self.assertListEqual(
            [p.name for p in Person.objects.filter(imdb=None)], [
                'Andrey Tarkovskiy', 'Yuri Yarvet', 'Sos Sarkisyan',
                'Yulian Semenov', 'Raymundas Banionis', 'Vyacheslav Tarasov',
                'Stanislav Lem', 'Eduard Artemev', 'Nina Markus'
            ])

        self.assertEqual(Person.objects.filter(first_name='').count(), 0)
        self.assertEqual(Person.objects.filter(last_name='').count(), 0)
        self.assertEqual(Person.objects.filter(first_name_en='').count(), 0)
        self.assertEqual(Person.objects.filter(last_name_en='').count(), 0)
        self.assertEqual(Person.objects.filter(first_name_ru='').count(), 0)
        self.assertEqual(Person.objects.filter(last_name_ru='').count(), 0)

        # check translated role names
        role = movie.cast.get(person__kinopoisk__id=185619)
        self.assertEqual(role.name_ru, 'Хари')
        self.assertEqual(role.name_en, 'Khari')
Esempio n. 7
0
    def test_sync_all_roles_of_movie_from_imdb_and_kinopoisk(self):
        imdb_movie = ImdbMovieFactory(id=64276)  # easy rider
        movie = imdb_movie.movie
        kp_movie = KinopoiskMovieFactory(id=4220, movie=movie)

        kp_movie.sync(roles='all')
        self.assertEqual(movie.cast.count(), 60)
        self.assertEqual(Person.objects.count(), 56)

        imdb_movie.sync(roles='all')
        self.assertEqual(movie.cast.count(), 60)
        self.assertEqual(Person.objects.count(), 56)

        self.assertEqual(Person.objects.filter(kinopoisk=None).count(), 0)
        self.assertEqual(Person.objects.filter(imdb=None).count(), 0)
        self.assertEqual(Person.objects.filter(first_name='').count(), 0)
        self.assertEqual(Person.objects.filter(last_name='').count(), 0)
        self.assertEqual(Person.objects.filter(first_name_en='').count(), 0)
        self.assertEqual(Person.objects.filter(last_name_en='').count(), 0)
        self.assertEqual(Person.objects.filter(first_name_ru='').count(), 0)
        self.assertEqual(Person.objects.filter(last_name_ru='').count(), 0)
Esempio n. 8
0
 def test_sync_all_roles_of_movie(self):
     imdb_movie = ImdbMovieFactory(id=64276)  # Easy rider
     imdb_movie.sync(roles='all')
     self.assertEqual(imdb_movie.movie.cast.count(), 60)
     self.assertEqual(
         imdb_movie.movie.cast.filter(role=self.actor).count(), 49)
     self.assertEqual(
         imdb_movie.movie.cast.filter(role=self.director).count(), 1)
     self.assertEqual(
         imdb_movie.movie.cast.filter(role=self.producer).count(), 4)
     self.assertEqual(
         imdb_movie.movie.cast.filter(role=self.scenarist).count(), 3)
     self.assertEqual(
         imdb_movie.movie.cast.filter(role=self.operator).count(), 2)
     self.assertEqual(
         imdb_movie.movie.cast.filter(role=self.editor).count(), 1)
     self.assertEqual(Person.objects.count(), 56)
     self.assertEqual(Person.objects.filter(imdb=None).count(), 0)
     self.assertEqual(Person.objects.filter(first_name='').count(), 0)
     self.assertEqual(Person.objects.filter(last_name='').count(), 0)
     self.assertEqual(Person.objects.filter(first_name_en='').count(), 0)
     self.assertEqual(Person.objects.filter(last_name_en='').count(), 0)
Esempio n. 9
0
 def test_movie_title_en(self):
     imdb_movie = ImdbMovieFactory(id=190332)
     imdb_movie.sync()
     self.assertEqual(imdb_movie.movie.title_original, 'Wo hu cang long')
     self.assertEqual(imdb_movie.movie.title_en,
                      'Crouching Tiger, Hidden Dragon')
Esempio n. 10
0
 def test_movie_genres_adams_family(self):
     imdb_movie = ImdbMovieFactory(id=57729, movie__genres=[])
     imdb_movie.sync()
     self.assertQuerysetEqual(
         imdb_movie.movie.genres.all(),
         ['Black and white', 'Comedy', 'Family', 'Horror', 'Series'])
Esempio n. 11
0
 def test_movie_genres_no_black_and_white_easy_rider(self):
     imdb_movie = ImdbMovieFactory(id=64276, movie__genres=[])
     imdb_movie.sync()
     self.assertQuerysetEqual(imdb_movie.movie.genres.all(),
                              ['Adventure', 'Drama'])
Esempio n. 12
0
 def test_get_movie_runtime_different_format(self):
     # runtime in format "xxxxx:17"
     imdb_movie = ImdbMovieFactory(id=1524546)
     imdb_movie.sync()
     self.assertEqual(imdb_movie.movie.runtime, 17)