コード例 #1
0
ファイル: test_views.py プロジェクト: daniloaf/moviesnetwork
 def test__get__actor_found__status_200(self):
     # Arrange
     self.service_mock.return_value = Actor.create(
         Person(
             personID=1,
             data={
                 'name': 'Actor1',
                 'headshot': 'hs',
                 'actor': [
                     IMDbMovie(
                         movieID=1,
                         data={
                             'title': 'mymovie',
                             'year': 2015,
                             'kind': 'movie'
                         })
                 ]
             }
         ),
         True
     )
     # Act
     response = self.client.get(self.url)
     # Assert
     self.assertEqual(response.status_code, status.HTTP_200_OK)
コード例 #2
0
 def test__get_actor_info__actor_found__actor(self):
     # Arrange
     person = Person(
         personID=1,
         data={
             "name": "Actor1",
             "headshot": "hs",
             "actor": [IMDbMovie(movieID=1, data={"title": "mymovie", "year": 2015, "kind": "movie"})],
         },
     )
     self.imdb_get_person_mock.return_value = person
     expected_actor = Actor.create(person, True)
     # Act
     actor = get_actor_info(1)
     # Assert
     self.assertEquals(actor, expected_actor)
コード例 #3
0
 def test__serialize__full_actor__serialized_data(self):
     # Arrange
     actor = Actor.create(
         Person(
             personID=1,
             data={
                 'name': 'Actor1',
                 'headshot': 'hs',
                 'actor': [
                     IMDbMovie(
                         movieID=1,
                         data={
                             'title': 'mymovie',
                             'year': 2015, 'kind': 'movie'
                         })
                 ]
             }
         ),
         True
     )
     expected_actor = {
         'actor_id': 1,
         'name': 'Actor1',
         'headshot': 'hs',
         'movies': [
             {
                 'movie_id': 1,
                 'title': 'mymovie',
                 'year': 2015,
                 'rating': None,
                 'cover': None}
         ]
     }
     # Act
     serializer = ActorSerializer(actor)
     # Assert
     self.assertEqual(serializer.data, expected_actor)