diff --git a/odoo/addons/base/tests/test_ir_mail_server.py b/odoo/addons/base/tests/test_ir_mail_server.py index 56edf81fda4..ccfcab4055a 100644 --- a/odoo/addons/base/tests/test_ir_mail_server.py +++ b/odoo/addons/base/tests/test_ir_mail_server.py @@ -9,6 +9,7 @@ from odoo.addons.base.tests.common import MockSmtplibCase from odoo.tests import tagged from odoo.tests.common import TransactionCase from odoo.tools import mute_logger +from odoo.tools import config @tagged('mail_server') @@ -338,7 +339,7 @@ class TestIrMailServer(TransactionCase, MockSmtplibCase): ) @mute_logger('odoo.models.unlink') - @patch.dict("odoo.tools.config.options", {"from_filter": "test.com", "smtp_server": "example.com"}) + @patch.dict(config.options, {"from_filter": "test.com", "smtp_server": "example.com"}) def test_mail_server_binary_arguments_domain(self): """Test the configuration provided in the odoo-bin arguments. @@ -390,7 +391,7 @@ class TestIrMailServer(TransactionCase, MockSmtplibCase): ) @mute_logger('odoo.models.unlink') - @patch.dict("odoo.tools.config.options", {"from_filter": "test.com", "smtp_server": "example.com"}) + @patch.dict(config.options, {"from_filter": "test.com", "smtp_server": "example.com"}) def test_mail_server_binary_arguments_domain_smtp_session(self): """Test the configuration provided in the odoo-bin arguments. @@ -433,7 +434,7 @@ class TestIrMailServer(TransactionCase, MockSmtplibCase): ) @mute_logger('odoo.models.unlink') - @patch.dict('odoo.tools.config.options', {'from_filter': 'fake.com', 'smtp_server': 'cli_example.com'}) + @patch.dict(config.options, {'from_filter': 'fake.com', 'smtp_server': 'cli_example.com'}) def test_mail_server_configuration_cli(self): """Check the mail server when the "smtp_authentication" is "cli". @@ -478,7 +479,7 @@ class TestIrMailServer(TransactionCase, MockSmtplibCase): ) @mute_logger('odoo.models.unlink') - @patch.dict('odoo.tools.config.options', {'from_filter': 'test.com', 'smtp_server': 'example.com'}) + @patch.dict(config.options, {'from_filter': 'test.com', 'smtp_server': 'example.com'}) def test_mail_server_mail_default_from_filter(self): """Test that the config parameter "mail.default.from_filter" overwrite the odoo-bin argument "--from-filter" diff --git a/odoo/addons/base/tests/test_mail.py b/odoo/addons/base/tests/test_mail.py index c1d96b7a5b5..7ae0fba7095 100644 --- a/odoo/addons/base/tests/test_mail.py +++ b/odoo/addons/base/tests/test_mail.py @@ -18,6 +18,7 @@ from odoo.tools import ( email_split, email_domain_normalize, misc, formataddr, prepend_html_content, + config, ) from . import test_mail_examples @@ -494,7 +495,7 @@ class TestEmailTools(BaseCase): class EmailConfigCase(TransactionCase): - @patch.dict("odoo.tools.config.options", {"email_from": "settings@example.com"}) + @patch.dict(config.options, {"email_from": "settings@example.com"}) def test_default_email_from(self, *args): """Email from setting is respected.""" # ICP setting is more important