aboutsummaryrefslogtreecommitdiffstats
path: root/api/resources/v2
diff options
context:
space:
mode:
authorRex Lee <limingjiang@huawei.com>2017-07-21 01:11:49 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-21 01:11:49 +0000
commit803844911ceb1886d8ff3bacc228bfe7aad2383b (patch)
tree2d77ed09abdb6addac1059711488724d2e201982 /api/resources/v2
parent134f17488b8d0038999a1395c55992a41abae226 (diff)
parentd2451a0232c9316b6d8d53c6b362fa6a840ff1e1 (diff)
Merge "Add API(v2) to add case 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 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})