mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-06-20 01:27:44 +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",
|
"LOG_WARN_WHEN_CC_EMAIL_LINKED_TO_MORE_THAN_1_USER",
|
||||||
True,
|
True,
|
||||||
):
|
):
|
||||||
logger.warning(
|
logger.warning(f"{MULTIPLE_USERS_SAME_EMAIL_MSG}: {cced_email}")
|
||||||
f"{MULTIPLE_USERS_SAME_EMAIL_MSG}: {cced_email}"
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
user_id = user_list[0]
|
user_id = user_list[0]
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ from . import utils
|
|||||||
import logging
|
import logging
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
import uuid
|
import uuid
|
||||||
import mock
|
|
||||||
|
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|
||||||
@ -488,33 +487,38 @@ class EmailInteractionsTestCase(TestCase):
|
|||||||
Verify that the duplicated email warning log is invoked
|
Verify that the duplicated email warning log is invoked
|
||||||
"""
|
"""
|
||||||
dup_email = "dup@helpdesk.test"
|
dup_email = "dup@helpdesk.test"
|
||||||
user_dup1 = User.objects.create(
|
User.objects.create(
|
||||||
username="User_dup1", email=dup_email,
|
username="User_dup1",
|
||||||
|
email=dup_email,
|
||||||
)
|
)
|
||||||
user_dup2 = User.objects.create(
|
User.objects.create(
|
||||||
username="User_dup2", email=dup_email,
|
username="User_dup2",
|
||||||
|
email=dup_email,
|
||||||
)
|
)
|
||||||
message, _, _ = utils.generate_text_email(locale="fr_FR")
|
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"]
|
cc_list = [dup_email, "alpha@acme.test", "beta@acme.test", "gamma@delta.test"]
|
||||||
message_id = uuid.uuid4().hex
|
message_id = uuid.uuid4().hex
|
||||||
|
|
||||||
message["Message-ID"] = message_id
|
message["Message-ID"] = message_id
|
||||||
message["Cc"] = ",".join(cc_list)
|
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)
|
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
|
# Check that the CC duplicate was still sent a notification email
|
||||||
email_count = len(mail.outbox)
|
email_count = len(mail.outbox)
|
||||||
found = False
|
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:
|
if dup_email in mail.outbox[i].to:
|
||||||
found = True
|
found = True
|
||||||
break
|
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(
|
def test_create_followup_from_email_with_valid_message_id_with_no_initial_cc_list(
|
||||||
self,
|
self,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user