diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2017-04-05 16:23:03 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2017-04-06 16:55:21 +0800 |
commit | aa823fd3bbe42ead475217e2a5b947a636cf63dd (patch) | |
tree | 68e9e80dae6bb6325de2d8a839ee9d5fe6055ca6 /utils/test/testapi/opnfv_testapi/resources/result_handlers.py | |
parent | 5412a1b30129d25b6f7f7de6c5262e2e3edc699b (diff) |
unify error message in TestAPI
Change-Id: I994feb7bf340c9e48bebe9fdf3dc3a76bc254652
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/resources/result_handlers.py')
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/result_handlers.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py index 3e78057ce..609c5ce20 100644 --- a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py @@ -12,6 +12,7 @@ import httplib from bson import objectid +from opnfv_testapi.common import message from opnfv_testapi.common import raises from opnfv_testapi.resources import handlers from opnfv_testapi.resources import result_models @@ -30,7 +31,7 @@ class GenericResultHandler(handlers.GenericApiHandler): try: value = int(value) except: - raises.BadRequest('{} must be int'.format(key)) + raises.BadRequest(message.must_int(key)) return value def set_query(self): @@ -144,23 +145,21 @@ class ResultsCLHandler(GenericResultHandler): return {'name': data.pod_name} def pod_error(data): - message = 'Could not find pod [{}]'.format(data.pod_name) - return httplib.NOT_FOUND, message + return httplib.NOT_FOUND, message.not_found('pod', data.pod_name) def project_query(data): return {'name': data.project_name} def project_error(data): - message = 'Could not find project [{}]'.format(data.project_name) - return httplib.NOT_FOUND, message + return httplib.NOT_FOUND, message.not_found('project', + data.project_name) def testcase_query(data): return {'project_name': data.project_name, 'name': data.case_name} def testcase_error(data): - message = 'Could not find testcase [{}] in project [{}]'\ - .format(data.case_name, data.project_name) - return httplib.NOT_FOUND, message + return httplib.NOT_FOUND, message.not_found('testcase', + data.case_name) miss_checks = ['pod_name', 'project_name', 'case_name'] db_checks = [('pods', True, pod_query, pod_error), |