summaryrefslogtreecommitdiffstats
path: root/utils/test/testapi/opnfv_testapi/resources/handlers.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/resources/handlers.py')
-rw-r--r--utils/test/testapi/opnfv_testapi/resources/handlers.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/utils/test/testapi/opnfv_testapi/resources/handlers.py b/utils/test/testapi/opnfv_testapi/resources/handlers.py
index dbf94eb75..2fc31ca45 100644
--- a/utils/test/testapi/opnfv_testapi/resources/handlers.py
+++ b/utils/test/testapi/opnfv_testapi/resources/handlers.py
@@ -85,7 +85,8 @@ class GenericApiHandler(web.RequestHandler):
"""
data = self.table_cls.from_dict(self.json_args)
for k, v in kwargs.iteritems():
- data.__setattr__(k, v)
+ if k != 'query':
+ data.__setattr__(k, v)
if self.table != 'results':
data.creation_date = datetime.now()
@@ -188,6 +189,14 @@ class GenericApiHandler(web.RequestHandler):
table = self.table
return self._eval_db(table, 'find_one', query)
+ def db_save(self, collection, data):
+ self._eval_db(collection, 'insert', data, check_keys=False)
+
+ def db_find_one(self, query, collection=None):
+ if not collection:
+ collection = self.table
+ return self._eval_db(collection, 'find_one', query)
+
class VersionHandler(GenericApiHandler):
@swagger.operation(nickname='listAllVersions')