-
-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix] mail_outbound_static fix pre-commit errore
- Loading branch information
1 parent
cc96dc2
commit 48dc81b
Showing
1 changed file
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,7 +125,7 @@ def test_send_email_injects_from_with_canonical(self): | |
proper handling in the split. | ||
""" | ||
user = "Test < User" | ||
self.message.replace_header("From", "%s <[email protected]>" % user) | ||
self.message.replace_header("From", f"{user} <[email protected]>") | ||
bounce_parameter = self.parameter_model.search( | ||
[("key", "=", "mail.bounce.alias")] | ||
) | ||
|
@@ -145,7 +145,7 @@ def test_send_email_injects_from_with_canonical(self): | |
def test_01_from_outgoing_server_domainone(self): | ||
self._init_mail_server_domain_whilelist_based() | ||
domain = "domainone.com" | ||
email_from = "Mitchell Admin <admin@%s>" % domain | ||
email_from = f"Mitchell Admin <admin@{domain}>" | ||
expected_mail_server = self.mail_server_domainone | ||
|
||
self.message.replace_header("From", email_from) | ||
|
@@ -168,7 +168,7 @@ def test_01_from_outgoing_server_domainone(self): | |
def test_02_from_outgoing_server_domaintwo(self): | ||
self._init_mail_server_domain_whilelist_based() | ||
domain = "domaintwo.com" | ||
email_from = "Mitchell Admin <admin@%s>" % domain | ||
email_from = f"Mitchell Admin <admin@{domain}>" | ||
expected_mail_server = self.mail_server_domaintwo | ||
|
||
self.message.replace_header("From", email_from) | ||
|
@@ -191,15 +191,15 @@ def test_02_from_outgoing_server_domaintwo(self): | |
def test_03_from_outgoing_server_another(self): | ||
self._init_mail_server_domain_whilelist_based() | ||
domain = "example.com" | ||
email_from = "Mitchell Admin <admin@%s>" % domain | ||
email_from = f"Mitchell Admin <admin@{domain}>" | ||
expected_mail_server = self.mail_server_domainone | ||
|
||
self.message.replace_header("From", email_from) | ||
# A mail server is configured for the email | ||
with self.mock_smtplib_connection(): | ||
message = self._send_mail(self.message) | ||
self.assertEqual( | ||
message["From"], "Mitchell Admin <%s>" % expected_mail_server.smtp_from | ||
message["From"], f"Mitchell Admin {expected_mail_server.smtp_from}" | ||
) | ||
|
||
used_mail_server = self.IrMailServer._get_mail_sever(domain) | ||
|
@@ -216,7 +216,7 @@ def test_03_from_outgoing_server_another(self): | |
def test_04_from_outgoing_server_none_use_config(self): | ||
self._init_mail_server_domain_whilelist_based() | ||
domain = "example.com" | ||
email_from = "Mitchell Admin <admin@%s>" % domain | ||
email_from = f"Mitchell Admin <admin@{domain}>" | ||
|
||
self._delete_mail_servers() | ||
self.assertFalse(self.IrMailServer.search([])) | ||
|
@@ -233,12 +233,12 @@ def test_04_from_outgoing_server_none_use_config(self): | |
# A mail server is configured for the email | ||
with self.mock_smtplib_connection(): | ||
message = self._send_mail(self.message) | ||
self.assertEqual(message["From"], "Mitchell Admin <%s>" % config_smtp_from) | ||
self.assertEqual(message["From"], f"Mitchell Admin {config_smtp_from}") | ||
|
||
used_mail_server = self.IrMailServer._get_mail_sever("example.com") | ||
used_mail_server = self.IrMailServer.browse(used_mail_server) | ||
self.assertFalse( | ||
used_mail_server, "using this mail server %s" % (used_mail_server.name) | ||
used_mail_server, f"using this mail server {used_mail_server.name}" | ||
) | ||
|
||
def test_05_from_outgoing_server_none_same_domain(self): | ||
|
@@ -255,7 +255,7 @@ def test_05_from_outgoing_server_none_same_domain(self): | |
" or smtp_domain_whitelist." | ||
) | ||
|
||
email_from = "Mitchell Admin <admin@%s>" % domain | ||
email_from = f"Mitchell Admin <admin@{domain}>" | ||
|
||
self._delete_mail_servers() | ||
self.assertFalse(self.IrMailServer.search([])) | ||
|
@@ -272,7 +272,7 @@ def test_05_from_outgoing_server_none_same_domain(self): | |
def test_06_from_outgoing_server_no_name_from(self): | ||
self._init_mail_server_domain_whilelist_based() | ||
domain = "example.com" | ||
email_from = "test@%s" % domain | ||
email_from = f"test@{domain}" | ||
expected_mail_server = self.mail_server_domainone | ||
|
||
self.message.replace_header("From", email_from) | ||
|
@@ -295,7 +295,7 @@ def test_06_from_outgoing_server_no_name_from(self): | |
def test_07_from_outgoing_server_multidomain_1(self): | ||
self._init_mail_server_domain_whilelist_based() | ||
domain = "domainthree.com" | ||
email_from = "Mitchell Admin <admin@%s>" % domain | ||
email_from = f"Mitchell Admin <admin@{domain}>" | ||
expected_mail_server = self.mail_server_domainthree | ||
|
||
self.message.replace_header("From", email_from) | ||
|
@@ -318,7 +318,7 @@ def test_07_from_outgoing_server_multidomain_1(self): | |
def test_08_from_outgoing_server_multidomain_3(self): | ||
self._init_mail_server_domain_whilelist_based() | ||
domain = "domainmulti.com" | ||
email_from = "test@%s" % domain | ||
email_from = f"test@{domain}" | ||
expected_mail_server = self.mail_server_domainthree | ||
|
||
self.message.replace_header("From", email_from) | ||
|