aboutsummaryrefslogtreecommitdiffstats
path: root/api/resources/v2
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2017-07-20 03:52:34 +0000
committerchenjiankun <chenjiankun1@huawei.com>2017-07-20 03:52:34 +0000
commite66428c34bde48ed4648a0628b86298cf26f5fb3 (patch)
tree414c973e5d126bc002357e4f29640ff9c47ca000 /api/resources/v2
parent423a206606c64552314263177f687671ffacb27a (diff)
Add API to delete certain test case
JIRA: YARDSTICK-745 API: /api/v2/yardstick/testcases/<case_name> METHOD: DELETE Change-Id: Ic75ee60abfc00d20328ee45b9830dea1fe464482 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
Diffstat (limited to 'api/resources/v2')
-rw-r--r--api/resources/v2/testcases.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/api/resources/v2/testcases.py b/api/resources/v2/testcases.py
index a14543c66..81b4aa88c 100644
--- a/api/resources/v2/testcases.py
+++ b/api/resources/v2/testcases.py
@@ -49,3 +49,14 @@ class V2Testcase(ApiResource):
return result_handler(consts.API_ERROR, 'case does not exist')
return result_handler(consts.API_SUCCESS, {'testcase': data})
+
+ def delete(self, case_name):
+ case_path = os.path.join(consts.TESTCASE_DIR, '{}.yaml'.format(case_name))
+
+ try:
+ os.remove(case_path)
+ except IOError as e:
+ if e.errno == errno.ENOENT:
+ return result_handler(consts.API_ERROR, 'case does not exist')
+
+ return result_handler(consts.API_SUCCESS, {'testcase': case_name})