Skip to content

Commit f9085b2

Browse files
[FIX] portal: fix test that breaks without demo data
Followup of odoo/odoo@d6d6bee : test was not written to be independent from demo data. Also update other tour that fails in no-demo mode as portal user has not enough address value set to continue the tour, compared to demo mode. Task-3871775 Runbot-56554 Runbot-56553 Runbot-61488 Runbot-58213 closes odoo#162340 X-original-commit: db6c468 Signed-off-by: Thibault Delavallee (tde) <[email protected]>
1 parent ecd700f commit f9085b2

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

addons/portal/tests/test_tours.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,31 @@
11
# -*- coding: utf-8 -*-
22
# Part of Odoo. See LICENSE file for full copyright and licensing details.
33

4-
from odoo.addons.base.tests.common import HttpCaseWithUserPortal
4+
from odoo.addons.base.tests.common import HttpCaseWithUserDemo, HttpCaseWithUserPortal
55
from odoo.tests import tagged
66

77

88
@tagged('post_install', '-at_install')
9-
class TestUi(HttpCaseWithUserPortal):
9+
class TestUi(HttpCaseWithUserDemo, HttpCaseWithUserPortal):
10+
11+
@classmethod
12+
def setUpClass(cls):
13+
super().setUpClass()
14+
# be sure some expected values are set otherwise homepage may fail
15+
cls.partner_portal.write({
16+
"city": "Bayonne",
17+
"company_name": "YourCompany",
18+
"country_id": cls.env.ref("base.us").id,
19+
"phone": "(683)-556-5104",
20+
"street": "858 Lynn Street",
21+
"zip": "07002",
22+
})
23+
1024
def test_01_portal_load_tour(self):
1125
self.start_tour("/", 'portal_load_homepage', login="portal")
1226

1327
def test_02_portal_load_tour_cant_edit_vat(self):
14-
willis = self.env.ref('base.demo_user0')
15-
willis.parent_id = self.env.ref('base.partner_demo').id
28+
willis = self.user_portal
29+
willis.parent_id = self.user_demo.partner_id.id
1630
self.start_tour("/", 'portal_load_homepage', login="portal")
1731
self.assertEqual(willis.phone, "+1 555 666 7788")

0 commit comments

Comments
 (0)