|
@ -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' |
|
|