def test_delete_project(self): self.generate_fixture_asset_type() self.generate_fixture_asset_types() self.generate_assigned_task() self.generate_fixture_episode() self.generate_fixture_sequence() self.generate_fixture_shot() breakdown_service.create_casting_link(self.shot.id, self.asset.id) project_id = str(self.project.id) deletion_service.remove_project(project_id) self.assertIsNone(Project.get(project_id))
def delete(self, instance_id): parser = reqparse.RequestParser() parser.add_argument("force", default=False, type=bool) args = parser.parse_args() project = self.get_model_or_404(instance_id) project_dict = project.serialize() if projects_service.is_open(project_dict): return { "error": True, "message": "Only closed projects can be deleted", }, 400 else: self.check_delete_permissions(project_dict) if args["force"] is True: deletion_service.remove_project(instance_id) else: project.delete() self.post_delete(project_dict) return "", 204