From a60e8c771cbe5c572aad1355a7fd324d9fd8431a Mon Sep 17 00:00:00 2001 From: Le H Ngo Date: Tue, 6 Feb 2024 21:29:33 +0000 Subject: [PATCH] Fixes to linting --- mail/libraries/routing_controller.py | 2 +- mail/tasks.py | 1 - mail/tests/test_resend_email.py | 6 +++--- mail/tests/test_select_email_for_sending.py | 10 +++++----- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/mail/libraries/routing_controller.py b/mail/libraries/routing_controller.py index f7d8bf99..a4fe7df5 100644 --- a/mail/libraries/routing_controller.py +++ b/mail/libraries/routing_controller.py @@ -186,7 +186,7 @@ def _collect_and_send(mail: Mail): if message_to_send_dto: if message_to_send_dto.receiver != SourceEnum.LITE and message_to_send_dto.subject: - send_email_task(mail_id=mail["id"], message=message_to_send_dto) + send_email_task(mail_id=mail.id, message=message_to_send_dto) update_mail(mail, message_to_send_dto) logger.info( diff --git a/mail/tasks.py b/mail/tasks.py index a6391594..42d4489a 100644 --- a/mail/tasks.py +++ b/mail/tasks.py @@ -1,6 +1,5 @@ import time -from hashlib import md5 from smtplib import SMTPException from contextlib import contextmanager from django.core.cache import cache diff --git a/mail/tests/test_resend_email.py b/mail/tests/test_resend_email.py index 1ee22a00..555ceed3 100644 --- a/mail/tests/test_resend_email.py +++ b/mail/tests/test_resend_email.py @@ -14,7 +14,7 @@ class LITEHMRCResendEmailTests(LiteHMRCTestClient): @mock.patch("mail.libraries.routing_controller.get_spire_to_dit_mailserver") @mock.patch("mail.libraries.routing_controller.get_hmrc_to_dit_mailserver") - @mock.patch("mail.libraries.routing_controller.send") + @mock.patch("mail.libraries.routing_controller.send_email_task") @mock.patch("mail.libraries.routing_controller.get_email_message_dtos") def test_resend_licence_data_mail_to_hmrc( self, @@ -66,7 +66,7 @@ def test_resend_licence_data_mail_to_hmrc( @mock.patch("mail.libraries.routing_controller.get_spire_to_dit_mailserver") @mock.patch("mail.libraries.routing_controller.get_hmrc_to_dit_mailserver") - @mock.patch("mail.libraries.routing_controller.send") + @mock.patch("mail.libraries.routing_controller.send_email_task") @mock.patch("mail.libraries.routing_controller.get_email_message_dtos") def test_resend_licence_reply_mail_to_spire( self, @@ -133,7 +133,7 @@ def test_resend_licence_reply_mail_to_spire( @mock.patch("mail.libraries.routing_controller.get_spire_to_dit_mailserver") @mock.patch("mail.libraries.routing_controller.get_hmrc_to_dit_mailserver") - @mock.patch("mail.libraries.routing_controller.send") + @mock.patch("mail.libraries.routing_controller.send_email_task") @mock.patch("mail.libraries.routing_controller.get_email_message_dtos") def test_resend_usage_data_mail_to_spire( self, diff --git a/mail/tests/test_select_email_for_sending.py b/mail/tests/test_select_email_for_sending.py index 3c09711e..b0618193 100644 --- a/mail/tests/test_select_email_for_sending.py +++ b/mail/tests/test_select_email_for_sending.py @@ -104,7 +104,7 @@ def test_email_selected_if_no_spire_data(self): @mock.patch("mail.libraries.routing_controller.get_spire_to_dit_mailserver") @mock.patch("mail.libraries.routing_controller.get_hmrc_to_dit_mailserver") - @mock.patch("mail.libraries.routing_controller.send") + @mock.patch("mail.libraries.routing_controller.send_email_task") @mock.patch("mail.libraries.routing_controller.get_email_message_dtos") def test_case1_sending_of_pending_licencedata_mails( self, @@ -164,7 +164,7 @@ def test_case1_sending_of_pending_licencedata_mails( @mock.patch("mail.libraries.routing_controller.get_spire_to_dit_mailserver") @mock.patch("mail.libraries.routing_controller.get_hmrc_to_dit_mailserver") - @mock.patch("mail.libraries.routing_controller.send") + @mock.patch("mail.libraries.routing_controller.send_email_task") @mock.patch("mail.libraries.routing_controller.get_email_message_dtos") def test_case2_sending_of_pending_usagedata_mails( self, @@ -229,7 +229,7 @@ def test_case2_sending_of_pending_usagedata_mails( @mock.patch("mail.libraries.routing_controller.get_spire_to_dit_mailserver") @mock.patch("mail.libraries.routing_controller.get_hmrc_to_dit_mailserver") - @mock.patch("mail.libraries.routing_controller.send") + @mock.patch("mail.libraries.routing_controller.send_email_task") @mock.patch("mail.libraries.routing_controller.get_email_message_dtos") def test_case3_sending_of_pending_licencedata_and_usagedata_mails_1( self, @@ -319,7 +319,7 @@ def test_case3_sending_of_pending_licencedata_and_usagedata_mails_1( @mock.patch("mail.libraries.routing_controller.get_spire_to_dit_mailserver") @mock.patch("mail.libraries.routing_controller.get_hmrc_to_dit_mailserver") - @mock.patch("mail.libraries.routing_controller.send") + @mock.patch("mail.libraries.routing_controller.send_email_task") @mock.patch("mail.libraries.routing_controller.get_email_message_dtos") def test_case3_sending_of_pending_licencedata_and_usagedata_mails_2( self, @@ -395,7 +395,7 @@ def test_case3_sending_of_pending_licencedata_and_usagedata_mails_2( @mock.patch("mail.libraries.routing_controller.get_spire_to_dit_mailserver") @mock.patch("mail.libraries.routing_controller.get_hmrc_to_dit_mailserver") - @mock.patch("mail.libraries.routing_controller.send") + @mock.patch("mail.libraries.routing_controller.send_email_task") @mock.patch("mail.libraries.routing_controller.get_email_message_dtos") def test_case4_sending_of_pending_licencedata_when_waiting_for_reply( self,