summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/resources/scenario_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/scenario_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/scenario_handlers.py')
-rw-r--r--testapi/opnfv_testapi/resources/scenario_handlers.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/testapi/opnfv_testapi/resources/scenario_handlers.py b/testapi/opnfv_testapi/resources/scenario_handlers.py
index 9d0233c..bad79fd 100644
--- a/testapi/opnfv_testapi/resources/scenario_handlers.py
+++ b/testapi/opnfv_testapi/resources/scenario_handlers.py
@@ -1,6 +1,7 @@
import functools
import httplib
+from opnfv_testapi.common import message
from opnfv_testapi.common import raises
from opnfv_testapi.resources import handlers
import opnfv_testapi.resources.scenario_models as models
@@ -82,8 +83,7 @@ class ScenariosCLHandler(GenericScenarioHandler):
return {'name': data.name}
def error(data):
- message = '{} already exists as a scenario'.format(data.name)
- return httplib.FORBIDDEN, message
+ return httplib.FORBIDDEN, message.exist('scenario', data.name)
miss_checks = ['name']
db_checks = [(self.table, False, query, error)]
@@ -184,7 +184,7 @@ class ScenarioGURHandler(GenericScenarioHandler):
def _update_requests_rename(self, data):
data.name = self._term.get('name')
if not data.name:
- raises.BadRequest("new scenario name is not provided")
+ raises.BadRequest(message.missing('name'))
def _update_requests_add_installer(self, data):
data.installers.append(models.ScenarioInstaller.from_dict(self._term))