aboutsummaryrefslogtreecommitdiffstats
path: root/api/resources
diff options
context:
space:
mode:
Diffstat (limited to 'api/resources')
-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})