mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-10 22:44:47 +02:00
Fix conflicts and linting
This commit is contained in:
parent
cf97531102
commit
d61e17a4ad
3 changed files with 5 additions and 6 deletions
|
@ -10,7 +10,7 @@ from django.core.management import BaseCommand
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from registrar.utility import csv_export
|
from registrar.utility import csv_export
|
||||||
from registrar.utility.s3_bucket import S3ClientHelper
|
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__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -198,13 +198,11 @@ class TestEmails(TestCase):
|
||||||
response = email.send_email_with_attachment(
|
response = email.send_email_with_attachment(
|
||||||
sender_email, recipient_email, subject, body, attachment_file, self.mock_client
|
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
|
# 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()
|
self.mock_client.send_raw_email.assert_called_once()
|
||||||
|
|
||||||
# Get the args passed to the `send_raw_email` method
|
# Get the args passed to the `send_raw_email` method
|
||||||
call_args = self.mock_client.send_raw_email.call_args[1]
|
call_args = self.mock_client.send_raw_email.call_args[1]
|
||||||
print("call_args is", call_args)
|
|
||||||
|
|
||||||
# Assert that the attachment filename is correct
|
# Assert that the attachment filename is correct
|
||||||
self.assertEqual(call_args["RawMessage"]["Data"].count(f'filename="{current_filename}"'), 1)
|
self.assertEqual(call_args["RawMessage"]["Data"].count(f'filename="{current_filename}"'), 1)
|
||||||
|
|
|
@ -5,7 +5,6 @@ import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.template.loader import get_template
|
from django.template.loader import get_template
|
||||||
from email.mime.base import MIMEBase
|
|
||||||
from email.mime.application import MIMEApplication
|
from email.mime.application import MIMEApplication
|
||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
|
@ -20,7 +19,9 @@ class EmailSendingError(RuntimeError):
|
||||||
pass
|
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.
|
"""Send an email built from a template to one email address.
|
||||||
|
|
||||||
template_name and subject_template_name are relative to the same template
|
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},
|
"Subject": {"Data": subject},
|
||||||
"Body": {"Text": {"Data": email_body}},
|
"Body": {"Text": {"Data": email_body}},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
ses_client = boto3.client(
|
ses_client = boto3.client(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue