diff --git a/src/registrar/management/commands/generate_current_metadata_report.py b/src/registrar/management/commands/generate_current_metadata_report.py index 2478f9e6b..a3c7f70e1 100644 --- a/src/registrar/management/commands/generate_current_metadata_report.py +++ b/src/registrar/management/commands/generate_current_metadata_report.py @@ -10,7 +10,7 @@ from django.core.management import BaseCommand from django.conf import settings from registrar.utility import csv_export from registrar.utility.s3_bucket import S3ClientHelper -from ...utility.email import send_templated_email, EmailSendingError +from ...utility.email import send_templated_email logger = logging.getLogger(__name__) diff --git a/src/registrar/tests/test_emails.py b/src/registrar/tests/test_emails.py index 292fe5b1c..2c480cec2 100644 --- a/src/registrar/tests/test_emails.py +++ b/src/registrar/tests/test_emails.py @@ -198,13 +198,11 @@ class TestEmails(TestCase): response = email.send_email_with_attachment( sender_email, recipient_email, subject, body, attachment_file, self.mock_client ) - print("response is", response) # Assert that the `send_raw_email` method of the mocked SES client was called with the expected params self.mock_client.send_raw_email.assert_called_once() # Get the args passed to the `send_raw_email` method call_args = self.mock_client.send_raw_email.call_args[1] - print("call_args is", call_args) # Assert that the attachment filename is correct self.assertEqual(call_args["RawMessage"]["Data"].count(f'filename="{current_filename}"'), 1) diff --git a/src/registrar/utility/email.py b/src/registrar/utility/email.py index 72bbbabc7..2fb08d10c 100644 --- a/src/registrar/utility/email.py +++ b/src/registrar/utility/email.py @@ -5,7 +5,6 @@ import logging from datetime import datetime from django.conf import settings from django.template.loader import get_template -from email.mime.base import MIMEBase from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText @@ -20,7 +19,9 @@ class EmailSendingError(RuntimeError): pass -def send_templated_email(template_name: str, subject_template_name: str, to_address: str, bcc_address="", context={}, file: str = None): +def send_templated_email( + template_name: str, subject_template_name: str, to_address: str, bcc_address="", context={}, file: str = None +): """Send an email built from a template to one email address. template_name and subject_template_name are relative to the same template @@ -60,7 +61,7 @@ def send_templated_email(template_name: str, subject_template_name: str, to_addr "Subject": {"Data": subject}, "Body": {"Text": {"Data": email_body}}, }, - } + }, ) else: ses_client = boto3.client(