aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/resources/v2/tasks.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/api/resources/v2/tasks.py b/api/resources/v2/tasks.py
index 2c4ff2c00..26da6715e 100644
--- a/api/resources/v2/tasks.py
+++ b/api/resources/v2/tasks.py
@@ -141,3 +141,26 @@ class V2Task(ApiResource):
task_handler.update_attr(task_id, {'environment_id': environment_id})
return result_handler(consts.API_SUCCESS, {'uuid': task_id})
+
+ def add_case(self, args):
+ task_id = args['task_id']
+ try:
+ name = args['case_name']
+ except KeyError:
+ return result_handler(consts.API_ERROR, 'case_name must be provided')
+
+ try:
+ content = args['case_content']
+ except KeyError:
+ return result_handler(consts.API_ERROR, 'case_content must be provided')
+
+ LOG.info('update case info in task')
+ task_handler = V2TaskHandler()
+ task_update_data = {
+ 'case_name': name,
+ 'content': content,
+ 'suite': False
+ }
+ task_handler.update_attr(task_id, task_update_data)
+
+ return result_handler(consts.API_SUCCESS, {'uuid': task_id})