[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) <rde@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
This commit is contained in:
Pierre Paridans
2023-12-18 21:13:03 +00:00
parent 79cf19dc3e
commit b9fd7c5ac9
+3 -1
View File
@@ -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']