summaryrefslogtreecommitdiffstats
path: root/api/resources/v2
diff options
context:
space:
mode:
authorRex Lee <limingjiang@huawei.com>2017-07-21 02:29:32 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-21 02:29:32 +0000
commit2d0247646d8f5b46c41f8429f439133745c5ed14 (patch)
treeea088c85ecb692b4463ba10260b1b09995011e39 /api/resources/v2
parentacc000cff316fa9883217121a3c30b0e2145a363 (diff)
parent8edc689554bd76045a1db0f93a778cbb05ebc70e (diff)
Merge "Add API(v2) to add suite to task"
Diffstat (limited to 'api/resources/v2')
-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 26da6715e..668f7648e 100644
--- a/api/resources/v2/tasks.py
+++ b/api/resources/v2/tasks.py
@@ -164,3 +164,26 @@ class V2Task(ApiResource):
task_handler.update_attr(task_id, task_update_data)
return result_handler(consts.API_SUCCESS, {'uuid': task_id})
+
+ def add_suite(self, args):
+ task_id = args['task_id']
+ try:
+ name = args['suite_name']
+ except KeyError:
+ return result_handler(consts.API_ERROR, 'suite_name must be provided')
+
+ try:
+ content = args['suite_content']
+ except KeyError:
+ return result_handler(consts.API_ERROR, 'suite_content must be provided')
+
+ LOG.info('update suite info in task')
+ task_handler = V2TaskHandler()
+ task_update_data = {
+ 'case_name': name,
+ 'content': content,
+ 'suite': True
+ }
+ task_handler.update_attr(task_id, task_update_data)
+
+ return result_handler(consts.API_SUCCESS, {'uuid': task_id})