def test_get_roles_of_actor(self):
        new_actor = Actor(**AppTestCase.test_actor)
        new_actor.insert()
        actor_id = new_actor.id
        new_movie = Movie(**AppTestCase.test_movie)
        new_movie.insert()
        new_role = Role(**AppTestCase.test_role)
        new_role.movie = new_movie
        new_role.actor = new_actor
        new_role.insert()

        res = self.client().get(f'/actors/{actor_id}/roles')
        data = json.loads(res.data)

        self.assertEqual(res.status_code, 200)
        self.assertTrue(data['success'])
        self.assertEqual(data['actor_id'], actor_id)
        self.assertTrue('actor_id' not in data['roles'][0])
    def test_get_roles_by_min_age(self):
        new_movie = Movie(**AppTestCase.test_movie)
        new_movie.insert()
        movie_id = new_movie.id

        new_actor = Actor(**AppTestCase.test_actor)
        new_actor.insert()

        new_role = Role(movie_id=movie_id, **AppTestCase.test_role)
        new_role.actor = new_actor
        new_role.insert()

        min_age = 20
        res = self.client().get(f'/roles?min_age={min_age}')
        data = json.loads(res.data)

        self.assertEqual(res.status_code, 200)
        self.assertTrue(data['success'])
        for role in data['roles']:
            self.assertTrue(role['min_age'] >= min_age)

        new_movie.delete()
        new_actor.delete()