Fix conflicts and linting

This commit is contained in:
Rebecca Hsieh 2024-03-05 12:03:11 -08:00
parent cf97531102
commit d61e17a4ad
No known key found for this signature in database
3 changed files with 5 additions and 6 deletions

View file

@ -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__)

View file

@ -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)

View file

@ -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(