summaryrefslogtreecommitdiffstats
path: root/utils/test/testapi/opnfv_testapi/ui
diff options
context:
space:
mode:
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/ui')
-rw-r--r--utils/test/testapi/opnfv_testapi/ui/auth/sign.py11
-rw-r--r--utils/test/testapi/opnfv_testapi/ui/auth/user.py3
-rw-r--r--utils/test/testapi/opnfv_testapi/ui/root.py4
3 files changed, 8 insertions, 10 deletions
diff --git a/utils/test/testapi/opnfv_testapi/ui/auth/sign.py b/utils/test/testapi/opnfv_testapi/ui/auth/sign.py
index 5b3622579..462395225 100644
--- a/utils/test/testapi/opnfv_testapi/ui/auth/sign.py
+++ b/utils/test/testapi/opnfv_testapi/ui/auth/sign.py
@@ -1,14 +1,12 @@
from six.moves.urllib import parse
from tornado import gen
from tornado import web
-import logging
-from opnfv_testapi.common import config
+from opnfv_testapi.common.config import CONF
+from opnfv_testapi.db import api as dbapi
from opnfv_testapi.ui.auth import base
from opnfv_testapi.ui.auth import constants as const
-CONF = config.Config()
-
class SigninHandler(base.BaseHandler):
def get(self):
@@ -48,10 +46,9 @@ class SigninReturnHandler(base.BaseHandler):
'fullname': self.get_query_argument(const.OPENID_NS_SREG_FULLNAME),
const.ROLE: role
}
- user = yield self.db_find_one({'openid': openid})
+ user = yield dbapi.db_find_one(self.table, {'openid': openid})
if not user:
- self.db_save(self.table, new_user_info)
- logging.info('save to db:%s', new_user_info)
+ dbapi.db_save(self.table, new_user_info)
else:
role = user.get(const.ROLE)
diff --git a/utils/test/testapi/opnfv_testapi/ui/auth/user.py b/utils/test/testapi/opnfv_testapi/ui/auth/user.py
index 2fca2a8cb..955cdeead 100644
--- a/utils/test/testapi/opnfv_testapi/ui/auth/user.py
+++ b/utils/test/testapi/opnfv_testapi/ui/auth/user.py
@@ -2,6 +2,7 @@ from tornado import gen
from tornado import web
from opnfv_testapi.common import raises
+from opnfv_testapi.db import api as dbapi
from opnfv_testapi.ui.auth import base
@@ -12,7 +13,7 @@ class ProfileHandler(base.BaseHandler):
openid = self.get_secure_cookie('openid')
if openid:
try:
- user = yield self.db_find_one({'openid': openid})
+ user = yield dbapi.db_find_one(self.table, {'openid': openid})
self.finish_request({
"openid": user.get('openid'),
"email": user.get('email'),
diff --git a/utils/test/testapi/opnfv_testapi/ui/root.py b/utils/test/testapi/opnfv_testapi/ui/root.py
index bba7a8632..5b2c922d7 100644
--- a/utils/test/testapi/opnfv_testapi/ui/root.py
+++ b/utils/test/testapi/opnfv_testapi/ui/root.py
@@ -1,10 +1,10 @@
from opnfv_testapi.resources.handlers import GenericApiHandler
-from opnfv_testapi.common import config
+from opnfv_testapi.common.config import CONF
class RootHandler(GenericApiHandler):
def get_template_path(self):
- return config.Config().static_path
+ return CONF.static_path
def get(self):
self.render('testapi-ui/index.html')