diff options
| author | Xavier Morel <xmo@odoo.com> | 2020-03-06 14:45:21 +0000 |
|---|---|---|
| committer | Olivier Dony <odo@odoo.com> | 2020-08-14 21:20:47 +0000 |
| commit | dccbf425a1742c08564d4f7b223ce27f8746c832 (patch) | |
| tree | 3a45016eb7a06a00cf41e95f722e0b9c69100a70 /addons | |
| parent | 950d962d95d214bdd1bdd64d8771af96d4d618cf (diff) | |
[FIX] core: ensure we create a new session for each tour
The browser itself would get mostly cleaned up between tours, but the
session object would not get cleaned, and apparently in some cases
that could lead to an incoherent session: a tour would add data to the
session which the next tour (logging in as a different user) would
not (fully) override, leading to a session inconsistency and a Session
Expired exception during the tour.
Fix by not storing the session on the test object, the session is
created during authentication then set on the opener & browser.
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/tests/test_portal_attachment.py | 2 | ||||
| -rw-r--r-- | addons/test_xlsx_export/tests/test_export.py | 4 | ||||
| -rw-r--r-- | addons/website/tests/test_page.py | 1 |
3 files changed, 5 insertions, 2 deletions
diff --git a/addons/account/tests/test_portal_attachment.py b/addons/account/tests/test_portal_attachment.py index 02ac0cf04a7..2340fc75f2a 100644 --- a/addons/account/tests/test_portal_attachment.py +++ b/addons/account/tests/test_portal_attachment.py @@ -32,6 +32,8 @@ class TestPortalAttachment(AccountTestInvoicingHttpCommon): def test_01_portal_attachment(self): """Test the portal chatter attachment route.""" + self.authenticate(None, None) + # Test public user can't create attachment without token of document res = self.url_open( url='%s/portal/attachment/add' % self.base_url, diff --git a/addons/test_xlsx_export/tests/test_export.py b/addons/test_xlsx_export/tests/test_export.py index df0f85a5a4c..5ba8c0a0de5 100644 --- a/addons/test_xlsx_export/tests/test_export.py +++ b/addons/test_xlsx_export/tests/test_export.py @@ -22,8 +22,8 @@ class XlsxCreatorCase(common.HttpCase): super().setUp() self.model = self.env[self.model_name] - u = mail_new_test_user(self.env, login='fof', password='123456789', groups='base.group_user,base.group_allow_export') - self.authenticate('fof', '123456789') + mail_new_test_user(self.env, login='fof', password='123456789', groups='base.group_user,base.group_allow_export') + self.session = self.authenticate('fof', '123456789') self.worksheet = {} # mock worksheet diff --git a/addons/website/tests/test_page.py b/addons/website/tests/test_page.py index eb7a1ba9976..7d7d0928518 100644 --- a/addons/website/tests/test_page.py +++ b/addons/website/tests/test_page.py @@ -222,6 +222,7 @@ class WithContext(HttpCase): specific_page = self.page.copy({'website_id': self.env['website'].get_current_website().id}) specific_page.write({'is_published': False, 'arch': self.page.arch.replace('I am a generic page', 'I am a specific page')}) + self.authenticate(None, None) r = self.url_open(specific_page.url) self.assertEqual(r.status_code, 404, "Restricted users should see a 404 and not the generic one as we unpublished the specific one") |
