summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/common/check.py
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi/common/check.py')
-rw-r--r--testapi/opnfv_testapi/common/check.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/testapi/opnfv_testapi/common/check.py b/testapi/opnfv_testapi/common/check.py
index 5dfbc75..333871d 100644
--- a/testapi/opnfv_testapi/common/check.py
+++ b/testapi/opnfv_testapi/common/check.py
@@ -158,3 +158,17 @@ def updated_one_not_exist(xstep):
ret = yield gen.coroutine(xstep)(self, data, *args, **kwargs)
raise gen.Return(ret)
return wrap
+
+
+def query_by_name(xstep):
+ @functools.wraps(xstep)
+ def wrap(self, *args, **kwargs):
+ if 'name' in self.request.query_arguments.keys():
+ query = kwargs.get('query', {})
+ query.update({'name': re.compile(self.get_query_argument('name'), re.IGNORECASE)})
+ kwargs.update({'query': query})
+
+ ret = yield gen.coroutine(xstep)(self, *args, **kwargs)
+ raise gen.Return(ret)
+
+ return wrap