From b9fd7c5ac938fb0fc265abc7a4d202c3fd090b7b Mon Sep 17 00:00:00 2001 From: Pierre Paridans Date: Thu, 7 Dec 2023 10:10:45 +0100 Subject: [PATCH] [FIX] website: broken assets test on multi website The `test_01_multi_domain_assets_generation` was introduced in PR [1]. But afterward, the commit [2] introduced a unique constraint on the `domain` field. With this additional constraint, this test broke when run with multiple existing websites as it assigns the same domain for each of them. This commit made the dummy domain assigned in this test non-unique, which doesn't alter the original meaning of the test but, allows to run it with multiple existing websites. [1]: https://github.com/odoo/odoo/pull/118526 [2]: https://github.com/odoo/odoo/commit/507db4e179514d171ec82e8ea0cbaf2323a6c30d runbot-20848 closes odoo/odoo#146666 X-original-commit: 0c522e42a82ec596e69611c556c4fc0d50e6e978 Signed-off-by: Romain Derie (rde) Signed-off-by: Pierre Paridans (app) --- addons/website/tests/test_assets.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/website/tests/test_assets.py b/addons/website/tests/test_assets.py index 35f31350aa8..e115d7a7325 100644 --- a/addons/website/tests/test_assets.py +++ b/addons/website/tests/test_assets.py @@ -13,9 +13,11 @@ class TestWebsiteAssets(odoo.tests.HttpCase): def test_01_multi_domain_assets_generation(self): Website = self.env['website'] Attachment = self.env['ir.attachment'] + # Create an additional website to ensure it works in multi-website setup + Website.create({'name': 'Second Website'}) # Simulate single website DBs: make sure other website do not interfer # (We can't delete those, constraint will most likely be raised) - Website.search([]).write({'domain': 'inactive.test'}) + [w.write({'domain': f'inactive-{w.id}.test'}) for w in Website.search([])] # Don't use HOST, hardcode it so it doesn't get changed one day and make # the test useless domain_1 = "http://127.0.0.1:%s" % config['http_port']