summaryrefslogtreecommitdiffstats
path: root/api/resources/v2
diff options
context:
space:
mode:
authorRex Lee <limingjiang@huawei.com>2017-07-21 01:14:50 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-21 01:14:50 +0000
commite8be89e06808273e5badc913af1781afb3dbdcb4 (patch)
treee79adb36dd119757b0ecd6c086f233510d4a167c /api/resources/v2
parent4d693a81dcd25e4ec86cbc0fc99c562a8496c279 (diff)
parente66428c34bde48ed4648a0628b86298cf26f5fb3 (diff)
Merge "Add API to delete certain test case"
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})