aboutsummaryrefslogtreecommitdiffstats
path: root/api/resources
diff options
context:
space:
mode:
authorRex Lee <limingjiang@huawei.com>2017-07-21 01:15:58 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-07-21 01:15:58 +0000
commit0d9d5a00f52bb65cb82ca7a603f187ea63c3d1fb (patch)
treee543c57842bef26dc5b1e272d8588f87bc570726 /api/resources
parent50be49a89258a373aa1bb61b9f7fd2f26f9241e8 (diff)
parentf37a9432640c981c77120e416fc6c08d6fd2ff77 (diff)
Merge "Add API(v2) to get certain test suite info"
Diffstat (limited to 'api/resources')
-rw-r--r--api/resources/v2/testsuites.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/api/resources/v2/testsuites.py b/api/resources/v2/testsuites.py
index 189988ea4..2e23f5b82 100644
--- a/api/resources/v2/testsuites.py
+++ b/api/resources/v2/testsuites.py
@@ -1,4 +1,5 @@
import os
+import errno
import logging
import yaml
@@ -54,3 +55,17 @@ class V2Testsuites(ApiResource):
yaml.dump(suite_content, f, default_flow_style=False)
return result_handler(consts.API_SUCCESS, {'suite': suite_name})
+
+
+class V2Testsuite(ApiResource):
+
+ def get(self, suite_name):
+ suite_path = os.path.join(consts.TESTSUITE_DIR, '{}.yaml'.format(suite_name))
+ try:
+ with open(suite_path) as f:
+ data = f.read()
+ 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': data})