summaryrefslogtreecommitdiffstats
path: root/utils/test/result_collection_api/opnfv_testapi/resources
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-06-15 09:49:35 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2016-06-15 16:05:37 +0800
commit72de1829c79a377e0ae1d69f0ebf6af495c06b08 (patch)
tree3b9914ed6ac1ef36092b264148a5db3e01e309f1 /utils/test/result_collection_api/opnfv_testapi/resources
parent09d46e12cd5983bcde49bd77499e1175e5ed118a (diff)
support keys start with '$' or contain '.' in testAPI
set check_keys=False in insert and update db fix update and insert stub in fake_pymongo.py add unittest for check_keys in test_fake_pymongo.py JIRA: FUNCTEST-313 Change-Id: I4051ec4a1c70996c87167643f6ea19993f5b0811 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test/result_collection_api/opnfv_testapi/resources')
-rw-r--r--utils/test/result_collection_api/opnfv_testapi/resources/handlers.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/utils/test/result_collection_api/opnfv_testapi/resources/handlers.py b/utils/test/result_collection_api/opnfv_testapi/resources/handlers.py
index cc4a4c357..873701103 100644
--- a/utils/test/result_collection_api/opnfv_testapi/resources/handlers.py
+++ b/utils/test/result_collection_api/opnfv_testapi/resources/handlers.py
@@ -98,7 +98,8 @@ class GenericApiHandler(RequestHandler):
if self.table != 'results':
data.creation_date = datetime.now()
- _id = yield self._eval_db(self.table, 'insert', data.format())
+ _id = yield self._eval_db(self.table, 'insert', data.format(),
+ check_keys=False)
if 'name' in self.json_args:
resource = data.name
else:
@@ -174,7 +175,8 @@ class GenericApiHandler(RequestHandler):
edit_request.update(self._update_requests(data))
""" Updating the DB """
- yield self._eval_db(self.table, 'update', query, edit_request)
+ yield self._eval_db(self.table, 'update', query, edit_request,
+ check_keys=False)
edit_request['_id'] = str(data._id)
self.finish_request(edit_request)
@@ -215,8 +217,8 @@ class GenericApiHandler(RequestHandler):
query[key] = new
return equal, query
- def _eval_db(self, table, method, *args):
- return eval('self.db.%s.%s(*args)' % (table, method))
+ def _eval_db(self, table, method, *args, **kwargs):
+ return eval('self.db.%s.%s(*args, **kwargs)' % (table, method))
def _eval_db_find_one(self, query, table=None):
if table is None: