aboutsummaryrefslogtreecommitdiffstats
path: root/api/views.py
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2016-11-29 17:53:25 +0000
committerchenjiankun <chenjiankun1@huawei.com>2016-12-01 02:16:06 +0000
commit2c9574a29c95abafb4d06eb76a18fba9930ec41b (patch)
tree24cab3571388a41ee22e647ce8b4bfa2fecfd29d /api/views.py
parent111759372ed1b8433498c53a3cb53e3eff158f50 (diff)
Add API to run test case under samples directory
JIRA: YARDSTICK-432 Change-Id: I8ca6409449e2b960ac9f48c8eb8a6ae9959a4fc8 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
Diffstat (limited to 'api/views.py')
-rw-r--r--api/views.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/api/views.py b/api/views.py
index 065de673b..f899251dd 100644
--- a/api/views.py
+++ b/api/views.py
@@ -13,6 +13,7 @@ from flask_restful import Resource
from api.utils import common as common_utils
from api.actions import test as test_action
+from api.actions import samples as samples_action
from api.actions import result as result_action
from api.actions import env as env_action
@@ -31,6 +32,18 @@ class Release(Resource):
return common_utils.error_handler('Wrong action')
+class Samples(Resource):
+ def post(self):
+ action = common_utils.translate_to_str(request.json.get('action', ''))
+ args = common_utils.translate_to_str(request.json.get('args', {}))
+ logger.debug('Input args is: action: %s, args: %s', action, args)
+
+ try:
+ return getattr(samples_action, action)(args)
+ except AttributeError:
+ return common_utils.error_handler('Wrong action')
+
+
class Results(Resource):
def get(self):
args = common_utils.translate_to_str(request.args)