From 90f411ea032f07f2329cb6118113617787291322 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Thu, 9 Dec 2021 18:48:51 +0000 Subject: [PATCH] [FIX] (test_)website: fix standalone tour Use theme_default instead of theme_common. Instead, theme_common is not available when only website is installed as it depends of the design-themes repository. closes odoo/odoo#82587 X-original-commit: a10522c6509caf7f09f21e6da3224d5865f0ba6a Signed-off-by: Romain Derie (rde) --- addons/test_website/__manifest__.py | 1 + .../test_views_during_module_operation.py | 33 ++++++++++--------- addons/website/tests/test_theme.py | 3 +- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/addons/test_website/__manifest__.py b/addons/test_website/__manifest__.py index 940143a7e37..4db9c946d45 100644 --- a/addons/test_website/__manifest__.py +++ b/addons/test_website/__manifest__.py @@ -15,6 +15,7 @@ models which only purpose is to run tests.""", 'depends': [ 'web_unsplash', 'website', + 'theme_default', ], 'data': [ 'views/templates.xml', diff --git a/addons/test_website/tests/test_views_during_module_operation.py b/addons/test_website/tests/test_views_during_module_operation.py index c050080079d..f776027bed1 100644 --- a/addons/test_website/tests/test_views_during_module_operation.py +++ b/addons/test_website/tests/test_views_during_module_operation.py @@ -118,20 +118,21 @@ def test_02_copy_ids_views_unlink_on_module_update(env): website_1 = env['website'].browse(1) website_2 = env['website'].browse(2) - theme_common = env.ref('base.module_theme_common') + theme_default = env.ref('base.module_theme_default') - # Install theme_common on website 1 and website 2 - (website_1 + website_2).theme_id = theme_common + # Install theme_default on website 1 and website 2 + (website_1 + website_2).theme_id = theme_default env['ir.module.module'].with_context(load_all_views=True)._theme_load(website_1) env['ir.module.module'].with_context(load_all_views=True)._theme_load(website_2) - key = 'theme_common.theme_child_view' + key = 'theme_default.theme_child_view' domain = [ ('type', '=', 'qweb'), ('key', '=', key), ] + def _simulate_xml_view(): - # Simulate a theme.ir.ui.view inside theme_common XML files + # Simulate a theme.ir.ui.view inside theme_default XML files base_view = env.ref('test_website.update_module_base_view') theme_child_view = ThemeView.create({ 'name': 'Theme Child View', @@ -146,7 +147,7 @@ def test_02_copy_ids_views_unlink_on_module_update(env): }) # Create IMD so when updating the module the views will be removed (not found in file) Imd.create({ - 'module': 'theme_common', + 'module': 'theme_default', 'name': 'theme_child_view', 'model': 'theme.ir.ui.view', 'res_id': theme_child_view.id, @@ -171,20 +172,20 @@ def test_02_copy_ids_views_unlink_on_module_update(env): return view_website_1, view_website_2, theme_child_view - ############################################ - ## CASE 1: generic update (-u, migration) ## - ############################################ + ########################################## + # CASE 1: generic update (-u, migration) # + ########################################## view_website_1, view_website_2, theme_child_view = _simulate_xml_view() # Upgrade the module - theme_common.button_immediate_upgrade() + theme_default.button_immediate_upgrade() env.reset() # clear the set of environments env = env() # get an environment that refers to the new registry # Ensure the theme.ir.ui.view got removed (since there is an IMD but not # present in XML files) - view = env.ref('theme_common.theme_child_view', False) + view = env.ref('theme_default.theme_child_view', False) assert not view, "Theme view should have been removed during module update." assert not theme_child_view.exists(),\ "Theme view should have been removed during module update. (2)" @@ -194,21 +195,21 @@ def test_02_copy_ids_views_unlink_on_module_update(env): assert not (view_website_1.exists() or view_website_2.exists()),\ "copy_ids views did not get removed! (2)" - ####################################################### - ## CASE 2: specific update (website theme selection) ## - ####################################################### + ##################################################### + # CASE 2: specific update (website theme selection) # + ##################################################### view_website_1, view_website_2, theme_child_view = _simulate_xml_view() # Upgrade the module with MockRequest(env, website=website_1): - theme_common.button_immediate_upgrade() + theme_default.button_immediate_upgrade() env.reset() # clear the set of environments env = env() # get an environment that refers to the new registry # Ensure the theme.ir.ui.view got removed (since there is an IMD but not # present in XML files) - view = env.ref('theme_common.theme_child_view', False) + view = env.ref('theme_default.theme_child_view', False) assert not view, "Theme view should have been removed during module update." assert not theme_child_view.exists(),\ "Theme view should have been removed during module update. (2)" diff --git a/addons/website/tests/test_theme.py b/addons/website/tests/test_theme.py index 4712a0d8447..1a4d8c81423 100644 --- a/addons/website/tests/test_theme.py +++ b/addons/website/tests/test_theme.py @@ -1,7 +1,8 @@ # coding: utf-8 -from odoo.tests import common +from odoo.tests import common, tagged +@tagged('-at_install', 'post_install') class TestTheme(common.TransactionCase): def test_theme_remove_working(self):