summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/resources/testcase_handlers.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2017-04-05 16:23:03 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2017-04-06 16:55:21 +0800
commit0620b2cbb21714c1a5e485186c46c2c24485ef37 (patch)
tree48fae29c4a2827d51ce6bc418910194b54d35f5c /testapi/opnfv_testapi/resources/testcase_handlers.py
parentdbdb452b2761a630ec8574b22553ac5531611201 (diff)
unify error message in TestAPI
Change-Id: I994feb7bf340c9e48bebe9fdf3dc3a76bc254652 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'testapi/opnfv_testapi/resources/testcase_handlers.py')
-rw-r--r--testapi/opnfv_testapi/resources/testcase_handlers.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/testapi/opnfv_testapi/resources/testcase_handlers.py b/testapi/opnfv_testapi/resources/testcase_handlers.py
index 1211a05..bc22b74 100644
--- a/testapi/opnfv_testapi/resources/testcase_handlers.py
+++ b/testapi/opnfv_testapi/resources/testcase_handlers.py
@@ -8,6 +8,7 @@
##############################################################################
import httplib
+from opnfv_testapi.common import message
from opnfv_testapi.resources import handlers
from opnfv_testapi.resources import testcase_models
from opnfv_testapi.tornado_swagger import swagger
@@ -58,13 +59,11 @@ class TestcaseCLHandler(GenericTestcaseHandler):
}
def p_error(data):
- message = 'Could not find project [{}]'.format(data.project_name)
- return httplib.FORBIDDEN, message
+ return httplib.FORBIDDEN, message.not_found('project',
+ data.project_name)
def tc_error(data):
- message = '{} already exists as a testcase in project {}'\
- .format(data.name, data.project_name)
- return httplib.FORBIDDEN, message
+ return httplib.FORBIDDEN, message.exist('testcase', data.name)
miss_checks = ['name']
db_checks = [(self.db_projects, True, p_query, p_error),