summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/common
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/common
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/common')
-rw-r--r--testapi/opnfv_testapi/common/message.py46
-rw-r--r--testapi/opnfv_testapi/common/raises.py8
2 files changed, 54 insertions, 0 deletions
diff --git a/testapi/opnfv_testapi/common/message.py b/testapi/opnfv_testapi/common/message.py
new file mode 100644
index 0000000..98536ff
--- /dev/null
+++ b/testapi/opnfv_testapi/common/message.py
@@ -0,0 +1,46 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corp
+# feng.xiaowei@zte.com.cn
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+not_found_base = 'Could Not Found'
+exist_base = 'Already Exists'
+
+
+def no_body():
+ return 'No Body'
+
+
+def not_found(key, value):
+ return '{} {} [{}]'.format(not_found_base, key, value)
+
+
+def missing(name):
+ return '{} Missing'.format(name)
+
+
+def exist(key, value):
+ return '{} [{}] {}'.format(key, value, exist_base)
+
+
+def bad_format(error):
+ return 'Bad Format [{}]'.format(error)
+
+
+def unauthorized():
+ return 'No Authentication Header'
+
+
+def invalid_token():
+ return 'Invalid Token'
+
+
+def no_update():
+ return 'Nothing to update'
+
+
+def must_int(name):
+ return '{} must be int'.format(name)
diff --git a/testapi/opnfv_testapi/common/raises.py b/testapi/opnfv_testapi/common/raises.py
index ed3a84e..ec6b8a5 100644
--- a/testapi/opnfv_testapi/common/raises.py
+++ b/testapi/opnfv_testapi/common/raises.py
@@ -1,3 +1,11 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corp
+# feng.xiaowei@zte.com.cn
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
import httplib
from tornado import web