Browse Source

Merge pull request #194 from gdgellatly/8.0-fix-test

[FIX] auth_from_http_remote_user: Update Tests to Correctly Get DB
pull/225/merge
Pedro M. Baeza 9 years ago
parent
commit
2cdbe73a84
  1. 11
      auth_from_http_remote_user/tests/test_res_users.py

11
auth_from_http_remote_user/tests/test_res_users.py

@ -45,11 +45,13 @@ class test_res_users(common.TransactionCase):
def test_login(self):
res_users_obj = self.registry('res.users')
res = res_users_obj.authenticate(common.DB, 'admin', 'admin', None)
res = res_users_obj.authenticate(
common.get_db_name(), 'admin', 'admin', None)
uid = res
self.assertTrue(res, "Basic login must works as expected")
token = "123456"
res = res_users_obj.authenticate(common.DB, 'admin', token, None)
res = res_users_obj.authenticate(
common.get_db_name(), 'admin', token, None)
self.assertFalse(res)
# mimic what the new controller do when it find a value in
# the http header (HTTP_REMODE_USER)
@ -60,10 +62,11 @@ class test_res_users(common.TransactionCase):
with mock_cursor(self.cr):
# We can verifies that the given (uid, token) is authorized for
# the database
res_users_obj.check(common.DB, uid, token)
res_users_obj.check(common.get_db_name(), uid, token)
# we are able to login with the new token
res = res_users_obj.authenticate(common.DB, 'admin', token, None)
res = res_users_obj.authenticate(
common.get_db_name(), 'admin', token, None)
self.assertTrue(res)
@unittest.skipIf(os.environ.get('TRAVIS'),

Loading…
Cancel
Save