From aa823fd3bbe42ead475217e2a5b947a636cf63dd Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Wed, 5 Apr 2017 16:23:03 +0800 Subject: unify error message in TestAPI Change-Id: I994feb7bf340c9e48bebe9fdf3dc3a76bc254652 Signed-off-by: SerenaFeng --- utils/test/testapi/opnfv_testapi/common/message.py | 46 ++++++++++++++++++++++ utils/test/testapi/opnfv_testapi/common/raises.py | 8 ++++ 2 files changed, 54 insertions(+) create mode 100644 utils/test/testapi/opnfv_testapi/common/message.py (limited to 'utils/test/testapi/opnfv_testapi/common') diff --git a/utils/test/testapi/opnfv_testapi/common/message.py b/utils/test/testapi/opnfv_testapi/common/message.py new file mode 100644 index 000000000..98536ff4b --- /dev/null +++ b/utils/test/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/utils/test/testapi/opnfv_testapi/common/raises.py b/utils/test/testapi/opnfv_testapi/common/raises.py index ed3a84ee0..ec6b8a564 100644 --- a/utils/test/testapi/opnfv_testapi/common/raises.py +++ b/utils/test/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 -- cgit 1.2.3-korg