示例#1
0
 def test_delete_movies_ca(self):
     '''Test delete_movies as Casting Assistant '''
     movie = Movie(title='Test Movie', release_date='2020-01-15')
     movie.insert()
     res = self.client().delete(f'/movies/{movie.id}',
                                headers={'Authorization': bearer('ca')})
     self.assertEqual(res.status_code, 401)
     movie.delete()
示例#2
0
 def test_post_movie_actors_ca(self):
     '''Test post_actors as Casting Assistant '''
     movie = Movie(title='Test Movie', release_date='2020-01-15')
     movie.insert()
     actor = Actor(name='Test Actor', age=40, gender='M')
     actor.insert()
     res = self.client().post(f'/movies/{movie.id}/actors',
                              json={'actor': {
                                  'id': actor.id
                              }},
                              headers={'Authorization': bearer('ca')})
     self.assertEqual(res.status_code, 401)
     actor.delete()
     movie.delete()
示例#3
0
 def test_post_movie_actors_ep(self):
     '''Test post_actors as Executive Producer '''
     movie = Movie(title='Test Movie', release_date='2020-01-15')
     movie.insert()
     actor = Actor(name='Test Actor', age=40, gender='M')
     actor.insert()
     res = self.client().post(f'/movies/{movie.id}/actors',
                              json={'actor': {
                                  'id': actor.id
                              }},
                              headers={'Authorization': bearer('ep')})
     self.assertEqual(res.status_code, 200)
     self.assertIsInstance(res.json["movie"], dict)
     actor.delete()
     movie.delete()
示例#4
0
 def test_patch_movies_cd(self):
     '''Test patch_movies as Casting Director '''
     movie = Movie(title='Test Movie', release_date='2020-01-15')
     movie.insert()
     res = self.client().patch(f'/movies/{movie.id}',
                               json={
                                   'title': 'Test Movieeee',
                                   'release_date': '1920-01-15'
                               },
                               headers={'Authorization': bearer('cd')})
     self.assertEqual(res.status_code, 200)
     self.assertIsInstance(res.json['movie'], dict)
     movie = Movie.query.get(movie.id)
     self.assertEqual(movie.title, 'Test Movieeee')
     self.assertEqual(movie.release_date, '1920-01-15')
     movie.delete()
示例#5
0
 def test_delete_movie_actors_cd(self):
     '''Test delete_actors as Casting Director '''
     movie = Movie(title='Test Movie', release_date='2020-01-15')
     movie.insert()
     actor = Actor(name='Test Actor', age=40, gender='M')
     actor.insert()
     movie.actors.append(actor)
     movie.update()
     res = self.client().delete(f'/movies/{movie.id}/actors',
                                json={'actor': {
                                    'id': actor.id
                                }},
                                headers={'Authorization': bearer('cd')})
     self.assertEqual(res.status_code, 200)
     self.assertIsInstance(res.json["movie"], dict)
     movie.delete()
     actor.delete()