diff options
author | 2017-09-12 01:31:17 +0000 | |
---|---|---|
committer | 2017-09-12 01:31:17 +0000 | |
commit | a3ef9d8f755464ac8af4cc19efae970d69251010 (patch) | |
tree | fbc5c36bf9afca781ed225b6eb57cec024c18655 /utils/test/testapi/opnfv_testapi/common/check.py | |
parent | 4ef7b78012e3665299cb933448f208783adf6031 (diff) | |
parent | 6c5fcb955cada2b6323742a07ba4d38edd08ff67 (diff) |
Merge "add case-insensitive for find pods query"
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/common/check.py')
-rw-r--r-- | utils/test/testapi/opnfv_testapi/common/check.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/utils/test/testapi/opnfv_testapi/common/check.py b/utils/test/testapi/opnfv_testapi/common/check.py index 24ba876a9..acd331784 100644 --- a/utils/test/testapi/opnfv_testapi/common/check.py +++ b/utils/test/testapi/opnfv_testapi/common/check.py @@ -7,6 +7,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## import functools +import re from tornado import gen from tornado import web @@ -92,7 +93,12 @@ def new_not_exists(xstep): def wrap(self, *args, **kwargs): query = kwargs.get('query') if query: - to_data = yield dbapi.db_find_one(self.table, query()) + query_data = query() + if self.table == 'pods': + if query_data.get('name') is not None: + query_data['name'] = re.compile(query_data.get('name'), + re.IGNORECASE) + to_data = yield dbapi.db_find_one(self.table, query_data) if to_data: raises.Forbidden(message.exist(self.table, query())) ret = yield gen.coroutine(xstep)(self, *args, **kwargs) |