mirror of
https://github.com/odoo/design-themes.git
synced 2025-10-07 01:18:52 +07:00
[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]: https://github.com/odoo/odoo/commit/4231c9e545fdebdad034a4418f2a11e6691bac61
runbot-232963
closes odoo/design-themes#1160
X-original-commit: 501f57e840
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from odoo.addons.http_routing.tests.common import MockRequest
|
||||||
from odoo.tests import standalone
|
from odoo.tests import standalone
|
||||||
|
|
||||||
|
|
||||||
@@ -63,12 +65,15 @@ def test_02_theme_default_generate_primary_templates(env):
|
|||||||
template_key = f'website.configurator_{page}_{snippet}'
|
template_key = f'website.configurator_{page}_{snippet}'
|
||||||
assert template_key in template_keys, f"{template_key} should exist"
|
assert template_key in template_keys, f"{template_key} should exist"
|
||||||
|
|
||||||
env['website'].with_context(website_id=1).configurator_apply(
|
website = env['website'].search([], limit=1)
|
||||||
selected_features=[1, 2, 3, 4],
|
website.ensure_one()
|
||||||
industry_id=2836,
|
with MockRequest(env, website=website):
|
||||||
industry_name='private university',
|
website.configurator_apply(
|
||||||
selected_palette='default-15',
|
selected_features=[1, 2, 3, 4],
|
||||||
theme_name='theme_bewise',
|
industry_id=2836,
|
||||||
website_purpose='get_leads',
|
industry_name='private university',
|
||||||
website_type='business',
|
selected_palette='default-15',
|
||||||
)
|
theme_name='theme_bewise',
|
||||||
|
website_purpose='get_leads',
|
||||||
|
website_type='business',
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user