|
| 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