Skip to content

Commit 1d47f8a

Browse files
rdeodoobso-odoo
authored andcommitted
[IMP] test_themes: add test for fix about primary template generation
See previous commit. closes #761 X-original-commit: 14c3bbb Related: odoo/odoo#151375 Signed-off-by: Romain Derie (rde) <[email protected]>
1 parent 9c0707c commit 1d47f8a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

test_themes/tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33

44
from . import test_crawl
55
from . import test_new_page_templates
6+
from . import test_theme_standalone
67
from . import test_theme_upgrade

test_themes/tests/test_theme_standalone.py

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

4+
from odoo.addons.website.tools import MockRequest
45
from odoo.tests import standalone
56

67

8+
@standalone('website_standalone')
9+
def test_01_theme_install_generate_primary_templates(env):
10+
""" This test ensures the theme `_generate_primary_snippet_templates()`
11+
method is correctly called before xml views are generated.
12+
"""
13+
# 1. Setup
14+
theme_buzzy = env.ref('base.module_theme_clean')
15+
16+
if theme_buzzy.state == 'installed':
17+
theme_buzzy.button_immediate_uninstall()
18+
# Ensure those views are deleted to mimic the initial state of theme not installed.
19+
# Because "theme_buzzy" was installed before through "test_themes" dependencies, removing
20+
# those views is needed to replicate the bug: if the configurator views are not generated,
21+
# the theme install will fail because some of the imported views inherit them.
22+
env['ir.ui.view'].with_context(_force_unlink=True).search([('key', '=', 'website.configurator_s_banner')]).unlink()
23+
env['ir.ui.view'].with_context(_force_unlink=True).search([('key', '=', 'website.configurator_s_cover')]).unlink()
24+
theme_buzzy.button_immediate_install()
25+
726
@standalone('website_standalone')
827
def test_02_theme_default_generate_primary_templates(env):
928
# Verify that theme default's configurator templates are created

0 commit comments

Comments
 (0)