Skip to content

Commit 51c310c

Browse files
committed
[IMP] test_themes: test that theme_default templates are generated
This commit adds a test that verifies if the theme_default's configurator templates are generated whenever the website module is either installed or updated. Related to odoo/odoo#151501. task-3670496 closes #763 X-original-commit: b8aae07 Related: odoo/odoo#151682 Signed-off-by: Romain Derie (rde) <[email protected]> Signed-off-by: Benoit Socias (bso) <[email protected]>
1 parent aed6d05 commit 51c310c

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# -*- coding: utf-8 -*-
2+
# Part of Odoo. See LICENSE file for full copyright and licensing details.
3+
4+
from odoo.tests import standalone
5+
6+
7+
@standalone('website_standalone')
8+
def test_02_theme_default_generate_primary_templates(env):
9+
# Verify that theme default's configurator templates are created
10+
# on website update.
11+
theme_default = env.ref('base.module_theme_default')
12+
website_module = env.ref('base.module_website')
13+
14+
if theme_default.state == 'installed':
15+
theme_default.button_immediate_uninstall()
16+
env['ir.ui.view'].with_context(_force_unlink=True).search([('key', 'like', 'website.configurator_')]).unlink()
17+
18+
if website_module.state == 'installed':
19+
website_module.button_immediate_upgrade()
20+
else:
21+
website_module.button_immediate_install()
22+
23+
template_keys = env['ir.ui.view'].search([('key', 'like', 'website.configurator')]).mapped('key')
24+
manifest = env['ir.module.module'].get_module_info('theme_default')
25+
snippets_per_page = manifest.get('configurator_snippets')
26+
for page in snippets_per_page:
27+
for snippet in snippets_per_page[page]:
28+
template_key = f'website.configurator_{page}_{snippet}'
29+
assert template_key in template_keys, f"{template_key} should exist"
30+
31+
env['website'].with_context(website_id=1).configurator_apply(
32+
selected_features=[1, 2, 3, 4],
33+
industry_id=2836,
34+
industry_name='private university',
35+
selected_palette='default-15',
36+
theme_name='theme_bewise',
37+
website_purpose='get_leads',
38+
website_type='business',
39+
)

0 commit comments

Comments
 (0)