Exemple #1
0
 def test_delete_actors_ca(self):
     '''Test delete_actors as Casting Assistant '''
     actor = Actor(name='Test Actor', age=40, gender='M')
     actor.insert()
     res = self.client().delete(f'/actors/{actor.id}',
                                headers={'Authorization': bearer('ca')})
     self.assertEqual(res.status_code, 401)
     actor.delete()
Exemple #2
0
 def test_patch_actors_ca(self):
     '''Test patch_actors as Casting Assistant '''
     actor = Actor(name='Test Actor', age=40, gender='M')
     actor.insert()
     res = self.client().patch(f'/actors/{actor.id}',
                               json={
                                   'name': 'Test Actorrrr',
                                   'age': 45,
                                   'gender': 'F'
                               },
                               headers={'Authorization': bearer('ca')})
     self.assertEqual(res.status_code, 401)
     actor.delete()
Exemple #3
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()
Exemple #4
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()
Exemple #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()
Exemple #6
0
 def test_patch_actors_cd(self):
     '''Test patch_actors as Casting Director '''
     actor = Actor(name='Test Actor', age=40, gender='M')
     actor.insert()
     res = self.client().patch(f'/actors/{actor.id}',
                               json={
                                   'name': 'Test Actorrrr',
                                   'age': 45,
                                   'gender': 'F'
                               },
                               headers={'Authorization': bearer('cd')})
     self.assertEqual(res.status_code, 200)
     self.assertIsInstance(res.json["actor"], dict)
     actor = Actor.query.get(actor.id)
     self.assertEqual(actor.name, 'Test Actorrrr')
     self.assertEqual(actor.age, 45)
     self.assertEqual(actor.gender, 'F')
     actor.delete()