summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorRex Lee <limingjiang@huawei.com>2017-07-21 01:16:10 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-21 01:16:10 +0000
commitacc000cff316fa9883217121a3c30b0e2145a363 (patch)
treecbc3703d2684edce60bd0673c41bffcaf1e45b46 /api
parent0d9d5a00f52bb65cb82ca7a603f187ea63c3d1fb (diff)
parent9c7563db2dae93e131a75fe1fa8e0c8d0cd04a0f (diff)
Merge "Add API(v2) to delete certain test suite"
Diffstat (limited to 'api')
-rw-r--r--api/resources/v2/testsuites.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/api/resources/v2/testsuites.py b/api/resources/v2/testsuites.py
index 2e23f5b82..ee942eff9 100644
--- a/api/resources/v2/testsuites.py
+++ b/api/resources/v2/testsuites.py
@@ -69,3 +69,13 @@ class V2Testsuite(ApiResource):
return result_handler(consts.API_ERROR, 'suite does not exist')
return result_handler(consts.API_SUCCESS, {'testsuite': data})
+
+ def delete(self, suite_name):
+ suite_path = os.path.join(consts.TESTSUITE_DIR, '{}.yaml'.format(suite_name))
+ try:
+ os.remove(suite_path)
+ except IOError as e:
+ if e.errno == errno.ENOENT:
+ return result_handler(consts.API_ERROR, 'suite does not exist')
+
+ return result_handler(consts.API_SUCCESS, {'testsuite': suite_name})