diff --git a/helpdesk/email.py b/helpdesk/email.py index 33f15ca7..2af33f64 100644 --- a/helpdesk/email.py +++ b/helpdesk/email.py @@ -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] diff --git a/helpdesk/tests/test_ticket_submission.py b/helpdesk/tests/test_ticket_submission.py index 10951844..e2e5b3a2 100644 --- a/helpdesk/tests/test_ticket_submission.py +++ b/helpdesk/tests/test_ticket_submission.py @@ -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,