# Part of Odoo. See LICENSE file for full copyright and licensing details. import re import odoo.tests from odoo.tools import mute_logger def break_view(view, fr='
placeholder
', to=''): view.arch = view.arch.replace(fr, to) @odoo.tests.common.tagged('post_install', '-at_install') class TestWebsiteResetViews(odoo.tests.HttpCase): def do_test(self, name): self.browser_js( "/", "odoo.__DEBUG__.services['web_tour.tour'].run('%s')" % name, "odoo.__DEBUG__.services['web_tour.tour'].tours.%s.ready" % name, login="admin" ) def fix_it(self, page): self.authenticate("admin", "admin") resp = self.url_open(page) self.assertEqual(resp.status_code, 500, "Waiting 500") self.assertTrue('') # self.assertEqual(total_views + 1, self.View.search_count([('type', '=', 'qweb')]), "Missing COW view (1)") # self.fix_it('/test_view') # also mute ir.ui.view as `get_view_id()` will raise "Could not find view object with xml_id 'not.exist'"" @mute_logger('odoo.addons.website.models.ir_http', 'odoo.addons.website.models.ir_ui_view') def test_06_reset_specific_view_controller_inexisting_template(self): total_views = self.View.search_count([('type', '=', 'qweb')]) # Trigger COW then break the QWEB XML on it break_view(self.test_view.with_context(website_id=1), to='