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