summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/resources/result_handlers.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2017-03-30 14:01:30 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2017-03-30 14:01:30 +0800
commit87393f4eba3b68f9598c02dcbe1f06f2afdd400c (patch)
treed38571be07983f75fe36d8b92ca84c470b65a176 /testapi/opnfv_testapi/resources/result_handlers.py
parentbc563719888542de948e3145b22d944dc38f783c (diff)
replace self-defined http codes with standard definitions
Change-Id: I3045dc690e0bc1186f5c548cb533462dd03130d9 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'testapi/opnfv_testapi/resources/result_handlers.py')
-rw-r--r--testapi/opnfv_testapi/resources/result_handlers.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/testapi/opnfv_testapi/resources/result_handlers.py b/testapi/opnfv_testapi/resources/result_handlers.py
index d41ba48..44b9f8c 100644
--- a/testapi/opnfv_testapi/resources/result_handlers.py
+++ b/testapi/opnfv_testapi/resources/result_handlers.py
@@ -8,11 +8,11 @@
##############################################################################
from datetime import datetime
from datetime import timedelta
+import httplib
from bson import objectid
from tornado import web
-from opnfv_testapi.common import constants
from opnfv_testapi.resources import handlers
from opnfv_testapi.resources import result_models
from opnfv_testapi.tornado_swagger import swagger
@@ -30,7 +30,7 @@ class GenericResultHandler(handlers.GenericApiHandler):
try:
value = int(value)
except:
- raise web.HTTPError(constants.HTTP_BAD_REQUEST,
+ raise web.HTTPError(httplib.BAD_REQUEST,
'{} must be int'.format(key))
return value
@@ -146,14 +146,14 @@ class ResultsCLHandler(GenericResultHandler):
def pod_error(data):
message = 'Could not find pod [{}]'.format(data.pod_name)
- return constants.HTTP_NOT_FOUND, message
+ return httplib.NOT_FOUND, message
def project_query(data):
return {'name': data.project_name}
def project_error(data):
message = 'Could not find project [{}]'.format(data.project_name)
- return constants.HTTP_NOT_FOUND, message
+ return httplib.NOT_FOUND, message
def testcase_query(data):
return {'project_name': data.project_name, 'name': data.case_name}
@@ -161,7 +161,7 @@ class ResultsCLHandler(GenericResultHandler):
def testcase_error(data):
message = 'Could not find testcase [{}] in project [{}]'\
.format(data.case_name, data.project_name)
- return constants.HTTP_NOT_FOUND, message
+ return httplib.NOT_FOUND, message
miss_checks = ['pod_name', 'project_name', 'case_name']
db_checks = [('pods', True, pod_query, pod_error),