diff options
author | Linda Wang <wangwulin@huawei.com> | 2017-09-05 12:22:27 +0000 |
---|---|---|
committer | Linda Wang <wangwulin@huawei.com> | 2017-09-05 12:22:27 +0000 |
commit | 808319c010baf449808214ec06237b4703af39c6 (patch) | |
tree | 6fddac942ac6cf3a164cc046b2fcce264aa9ffcb /functest/api/resources/v1/testcases.py | |
parent | 38906080fd7c30a7f39ce9daa68d9150d63f80e3 (diff) |
unify all the return status as number
Change-Id: I835a368fe78329e60e811e40c24f3609c7a8960c
Signed-off-by: Linda Wang <wangwulin@huawei.com>
Diffstat (limited to 'functest/api/resources/v1/testcases.py')
-rw-r--r-- | functest/api/resources/v1/testcases.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/functest/api/resources/v1/testcases.py b/functest/api/resources/v1/testcases.py index d708cf37..b7d7b4aa 100644 --- a/functest/api/resources/v1/testcases.py +++ b/functest/api/resources/v1/testcases.py @@ -17,7 +17,7 @@ import pkg_resources import uuid import ConfigParser -from flask import abort, jsonify +from flask import jsonify from functest.api.base import ApiResource from functest.api.common import api_utils, thread @@ -46,8 +46,11 @@ class V1Testcase(ApiResource): """ GET the info of one testcase""" testcase = Testcase().show(testcase_name) if not testcase: - abort(404, "The test case '%s' does not exist or is not supported" - % testcase_name) + return api_utils.result_handler( + status=1, + data="The test case '%s' does not exist or is not supported" + % testcase_name) + testcase_info = api_utils.change_obj_to_dict(testcase) dependency_dict = api_utils.change_obj_to_dict( testcase_info.get('dependency')) @@ -70,6 +73,13 @@ class V1Testcase(ApiResource): return api_utils.result_handler( status=1, data='testcase name must be provided') + testcase = Testcase().show(case_name) + if not testcase: + return api_utils.result_handler( + status=1, + data="The test case '%s' does not exist or is not supported" + % case_name) + task_id = str(uuid.uuid4()) task_args = {'testcase': case_name, 'task_id': task_id} |