mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-06-19 17:18:23 +02:00
Formatting fixes
This commit is contained in:
parent
13c18e8126
commit
c713e3ea16
@ -564,9 +564,7 @@ def create_ticket_cc(ticket, cc_list, logger):
|
||||
"LOG_WARN_WHEN_CC_EMAIL_LINKED_TO_MORE_THAN_1_USER",
|
||||
True,
|
||||
):
|
||||
logger.warning(
|
||||
f"{MULTIPLE_USERS_SAME_EMAIL_MSG}: {cced_email}"
|
||||
)
|
||||
logger.warning(f"{MULTIPLE_USERS_SAME_EMAIL_MSG}: {cced_email}")
|
||||
else:
|
||||
user_id = user_list[0]
|
||||
|
||||
|
@ -18,7 +18,6 @@ from . import utils
|
||||
import logging
|
||||
from urllib.parse import urlparse
|
||||
import uuid
|
||||
import mock
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
@ -488,33 +487,38 @@ class EmailInteractionsTestCase(TestCase):
|
||||
Verify that the duplicated email warning log is invoked
|
||||
"""
|
||||
dup_email = "dup@helpdesk.test"
|
||||
user_dup1 = User.objects.create(
|
||||
username="User_dup1", email=dup_email,
|
||||
User.objects.create(
|
||||
username="User_dup1",
|
||||
email=dup_email,
|
||||
)
|
||||
user_dup2 = User.objects.create(
|
||||
username="User_dup2", email=dup_email,
|
||||
User.objects.create(
|
||||
username="User_dup2",
|
||||
email=dup_email,
|
||||
)
|
||||
message, _, _ = utils.generate_text_email(locale="fr_FR")
|
||||
|
||||
submitter_email = "foo@bar.py"
|
||||
cc_list = [dup_email, "alpha@acme.test", "beta@acme.test", "gamma@delta.test"]
|
||||
message_id = uuid.uuid4().hex
|
||||
|
||||
message["Message-ID"] = message_id
|
||||
message["Cc"] = ",".join(cc_list)
|
||||
|
||||
with self.assertLogs('helpdesk', level='WARNING') as dup_warn:
|
||||
with self.assertLogs("helpdesk", level="WARNING") as dup_warn:
|
||||
extract_email_metadata(str(message), self.queue_public, logger=logger)
|
||||
self.assertTrue(MULTIPLE_USERS_SAME_EMAIL_MSG in dup_warn.output[0], "The duplicated email across user ID's was was not logged.")
|
||||
self.assertTrue(
|
||||
MULTIPLE_USERS_SAME_EMAIL_MSG in dup_warn.output[0],
|
||||
"The duplicated email across user ID's was was not logged.",
|
||||
)
|
||||
# Check that the CC duplicate was still sent a notification email
|
||||
email_count = len(mail.outbox)
|
||||
found = False
|
||||
for i in range(0, email_count-1):
|
||||
for i in range(0, email_count - 1):
|
||||
if dup_email in mail.outbox[i].to:
|
||||
found = True
|
||||
break
|
||||
self.assertTrue(found, "The duplicated email across user ID's was not sent a n otification.")
|
||||
|
||||
self.assertTrue(
|
||||
found, "The duplicated email across user ID's was not sent a n otification."
|
||||
)
|
||||
|
||||
def test_create_followup_from_email_with_valid_message_id_with_no_initial_cc_list(
|
||||
self,
|
||||
|
Loading…
x
Reference in New Issue
Block a user