Skip to content

Commit 23c7f7c

Browse files
committed
[FIX] test_themes: run configurator standalone test under mocked request
Commit [1] copies configurator pages during the flow. When the standalone test leaves website_id in the context, that copy now tries to create generic views with a website-scoped environment and hits the ir.ui.view guard. Running the configurator inside MockRequest mimics the real HTTP context (request-driven website, no forced id on the ORM), so the copy succeeds and the test passes again. [1]: odoo/odoo@4231c9e runbot-232963 closes #1160 X-original-commit: 501f57e Signed-off-by: Quentin Smetz (qsm) <[email protected]>
1 parent 12243da commit 23c7f7c

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

test_themes/tests/test_theme_standalone.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Part of Odoo. See LICENSE file for full copyright and licensing details.
22

33
from unittest.mock import patch
4+
5+
from odoo.addons.http_routing.tests.common import MockRequest
46
from odoo.tests import standalone
57

68

@@ -63,12 +65,15 @@ def fake_olg_api(self, path, payload):
6365
template_key = f'website.configurator_{page}_{snippet}'
6466
assert template_key in template_keys, f"{template_key} should exist"
6567

66-
env['website'].with_context(website_id=1).configurator_apply(
67-
selected_features=[1, 2, 3, 4],
68-
industry_id=2836,
69-
industry_name='private university',
70-
selected_palette='default-15',
71-
theme_name='theme_bewise',
72-
website_purpose='get_leads',
73-
website_type='business',
74-
)
68+
website = env['website'].search([], limit=1)
69+
website.ensure_one()
70+
with MockRequest(env, website=website):
71+
website.configurator_apply(
72+
selected_features=[1, 2, 3, 4],
73+
industry_id=2836,
74+
industry_name='private university',
75+
selected_palette='default-15',
76+
theme_name='theme_bewise',
77+
website_purpose='get_leads',
78+
website_type='business',
79+
)

0 commit comments

Comments
 (0)