From bb65f518c3156a7235e312991ec5a2ebd7ab6f80 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Fri, 16 Sep 2022 16:18:36 +0000 Subject: [PATCH] [FIX] website: empty website domain correctly in tests Emptying the domain should be setting it to False, not empty string, which is saved in DB as such. This was not problematic at all before but since [1] the domain must be unique. As we removed the "multi website by domain" feature, we then were able to add that constraint. But since then, having two website with domain == '' would raise the constraint error, while null values (False in python) would not. [1]: https://github.com/odoo/odoo/commit/507db4e179514d171ec82e8ea0cbaf2323a6c30d runbot-5041 closes odoo/odoo#100430 Signed-off-by: Quentin Smetz (qsm) --- addons/website/tests/test_get_current_website.py | 2 +- addons/website/tests/test_page.py | 1 - addons/website/tests/test_website_reset_password.py | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/website/tests/test_get_current_website.py b/addons/website/tests/test_get_current_website.py index 554291a0728..c23d5653902 100644 --- a/addons/website/tests/test_get_current_website.py +++ b/addons/website/tests/test_get_current_website.py @@ -28,7 +28,7 @@ class TestGetCurrentWebsite(TransactionCase): # clean initial state website1 = self.website - website1.domain = '' + website1.domain = False website2 = Website.create({'name': 'My Website 2'}) diff --git a/addons/website/tests/test_page.py b/addons/website/tests/test_page.py index 5d460c740b1..d8a859d516a 100644 --- a/addons/website/tests/test_page.py +++ b/addons/website/tests/test_page.py @@ -186,7 +186,6 @@ class TestPage(common.TransactionCase): self.env['website'].create({ 'name': 'My Second Website', - 'domain': '', }) # currently the view unlink of website.page can't handle views with inherited views diff --git a/addons/website/tests/test_website_reset_password.py b/addons/website/tests/test_website_reset_password.py index 194785ab2f0..b104871643c 100644 --- a/addons/website/tests/test_website_reset_password.py +++ b/addons/website/tests/test_website_reset_password.py @@ -51,7 +51,7 @@ class TestWebsiteResetPassword(HttpCase): user.action_reset_password() self.assertIn(website_1.domain, user.signup_url) - (website_1 + website_2).domain = "" + (website_1 + website_2).domain = False user.action_reset_password() self.env.invalidate_all()