summaryrefslogtreecommitdiffstats
path: root/utils/test/testapi/opnfv_testapi/resources
diff options
context:
space:
mode:
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/resources')
-rw-r--r--utils/test/testapi/opnfv_testapi/resources/handlers.py11
-rw-r--r--utils/test/testapi/opnfv_testapi/resources/ui_handlers.py11
2 files changed, 10 insertions, 12 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')
diff --git a/utils/test/testapi/opnfv_testapi/resources/ui_handlers.py b/utils/test/testapi/opnfv_testapi/resources/ui_handlers.py
deleted file mode 100644
index 4c14802c4..000000000
--- a/utils/test/testapi/opnfv_testapi/resources/ui_handlers.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from opnfv_testapi.resources.handlers import GenericApiHandler
-from opnfv_testapi.common import config
-
-
-class UIHandler(GenericApiHandler):
-
- def get_template_path(self):
- return config.Config().static_path
-
- def get(self):
- self.render('testapi-ui/index.html')