aboutsummaryrefslogtreecommitdiffstats
path: root/functest/api/resources/v1/tiers.py
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-09-05 12:22:27 +0000
committerLinda Wang <wangwulin@huawei.com>2017-09-05 12:22:27 +0000
commit808319c010baf449808214ec06237b4703af39c6 (patch)
tree6fddac942ac6cf3a164cc046b2fcce264aa9ffcb /functest/api/resources/v1/tiers.py
parent38906080fd7c30a7f39ce9daa68d9150d63f80e3 (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/tiers.py')
-rw-r--r--functest/api/resources/v1/tiers.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/functest/api/resources/v1/tiers.py b/functest/api/resources/v1/tiers.py
index 71a98bea..4f4849e9 100644
--- a/functest/api/resources/v1/tiers.py
+++ b/functest/api/resources/v1/tiers.py
@@ -13,9 +13,10 @@ Resources to handle tier related requests
import re
-from flask import abort, jsonify
+from flask import jsonify
from functest.api.base import ApiResource
+from functest.api.common import api_utils
from functest.cli.commands.cli_tier import Tier
@@ -46,7 +47,9 @@ class V1Tier(ApiResource):
""" GET the info of one tier """
testcases = Tier().gettests(tier_name)
if not testcases:
- abort(404, "The tier with name '%s' does not exist." % tier_name)
+ return api_utils.result_handler(
+ status=1,
+ data="The tier with name '%s' does not exist." % tier_name)
tier_info = Tier().show(tier_name)
tier_info.__dict__.pop('name')
tier_info.__dict__.pop('tests_array')
@@ -62,6 +65,8 @@ class V1TestcasesinTier(ApiResource):
""" GET all testcases within given tier """
testcases = Tier().gettests(tier_name)
if not testcases:
- abort(404, "The tier with name '%s' does not exist." % tier_name)
+ return api_utils.result_handler(
+ status=1,
+ data="The tier with name '%s' does not exist." % tier_name)
result = {'tier': tier_name, 'testcases': testcases}
return jsonify(result)