Browse Source

fixup! fixup! [FIX] Use _compute_session_token to invalidate user sessions on auth_session_timeout

pull/1495/head
George Daramouskas 6 years ago
parent
commit
85141533a6
No known key found for this signature in database GPG Key ID: 5B4EF742F8CD859C
  1. 7
      auth_session_timeout/tests/test_res_users.py

7
auth_session_timeout/tests/test_res_users.py

@ -32,7 +32,7 @@ class TestResUsers(TransactionCase):
""" Multi patch names in `odoo.addons.auth_session_timeout.models. """ Multi patch names in `odoo.addons.auth_session_timeout.models.
res_users` for mocking them. res_users` for mocking them.
:param assets: The symbols in res_users that will be patched with
:param assets: The symbols in res_users that will be patched with
MagicMock objects. MagicMock objects.
""" """
if assets is None: if assets is None:
@ -64,7 +64,7 @@ class TestResUsers(TransactionCase):
def test_session_validity_gets_session_file(self): def test_session_validity_gets_session_file(self):
""" All the sessions a user generates are saved as a file in the """ All the sessions a user generates are saved as a file in the
filesystem by Werkzeug.
filesystem by Werkzeug.
This function makes sure that our `_auth_timeout_check` makes an This function makes sure that our `_auth_timeout_check` makes an
attempt in fetching that file by the correct session id. attempt in fetching that file by the correct session id.
@ -120,8 +120,7 @@ class TestResUsers(TransactionCase):
""" """
with self._mock_assets(['http', 'getmtime']) as assets: with self._mock_assets(['http', 'getmtime']) as assets:
assets['getmtime'].return_value = 0 assets['getmtime'].return_value = 0
attrs = {'__nonzero__': lambda self: True}
assets['http'].request.configure_mock(**attrs)
assets['http'].request.env.user = self.TestUser
assets['http'].request.session.uid = self.TestUser.id assets['http'].request.session.uid = self.TestUser.id
assets['http'].request.session.dbname = self.env.cr.dbname assets['http'].request.session.dbname = self.env.cr.dbname
assets['http'].request.session.sid = '123' assets['http'].request.session.sid = '123'

Loading…
Cancel
Save