def test_remove_edit(self): edit_id = str(self.edit.id) self.assertIsNotNone(edit_id) edits_service.get_edit(edit_id) edits_service.remove_edit(edit_id) with pytest.raises(EditNotFoundException): edits_service.get_edit(edit_id)
def get(self, edit_id): """ Retrieve all task types related to a given edit. """ edit = edits_service.get_edit(edit_id) user_service.check_project_access(edit["project_id"]) user_service.check_entity_access(edit["id"]) return tasks_service.get_task_types_for_edit(edit_id)
def delete(self, edit_id): """ Delete given edit. """ force = self.get_force() edit = edits_service.get_edit(edit_id) user_service.check_manager_project_access(edit["project_id"]) edits_service.remove_edit(edit_id, force=force) return "", 204
def get(self, edit_id): """ Retrieve all previews related to a given edit. It sends them as a dict. Keys are related task type ids and values are arrays of preview for this task type. """ edit = edits_service.get_edit(edit_id) user_service.check_project_access(edit["project_id"]) user_service.check_entity_access(edit["id"]) return playlists_service.get_preview_files_for_entity(edit_id)
def post(self, project_id, task_type_id): """ Create a new task for given edit and task type. --- tags: - Tasks parameters: - in: path name: project_id required: True schema: type: UUID example: a24a6ea4-ce75-4665-a070-57453082c25 - in: path name: task_type_id required: True schema: type: UUID example: a24a6ea4-ce75-4665-a070-57453082c25 responses: 201: description: New task for given edit and task type created """ user_service.check_manager_project_access(project_id) task_type = tasks_service.get_task_type(task_type_id) edit_ids = request.json edits = [] if type(edit_ids) == list and len(edit_ids) > 0: for edit_id in edit_ids: edit = edits_service.get_edit(edit_id) if edit["project_id"] == project_id: edits.append(edit) else: criterions = query.get_query_criterions_from_request(request) criterions["project_id"] = project_id edits = edits_service.get_edits(criterions) tasks = tasks_service.create_tasks(task_type, edits) return tasks, 201
def test_get_edit(self): self.assertEqual(str(self.edit.id), edits_service.get_edit(self.edit.id)["id"])
def get_tasks_for_edit(edit_id, relations=False): """ Get all tasks for given edit. """ edit = edits_service.get_edit(edit_id) return get_task_dicts_for_entity(edit["id"], relations=relations)
def get(self, edit_id): edit = edits_service.get_edit(edit_id) user_service.check_project_access(edit["project_id"]) user_service.check_entity_access(edit["id"]) return edits_service.get_edit_versions(edit_id)