mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-20 17:56:11 +02:00
Personalize the unit test to look for the 'in review' copy in th email's body
This commit is contained in:
parent
31295053f9
commit
efc800a3bf
1 changed files with 17 additions and 6 deletions
|
@ -108,13 +108,24 @@ class TestDomainApplicationAdmin(TestCase):
|
||||||
# Use the model admin's save_model method
|
# Use the model admin's save_model method
|
||||||
model_admin.save_model(request, application, form=None, change=True)
|
model_admin.save_model(request, application, form=None, change=True)
|
||||||
|
|
||||||
# Assert that the email was sent
|
# Access the arguments passed to send_email
|
||||||
|
call_args = mock_client_instance.send_email.call_args
|
||||||
|
args, kwargs = call_args
|
||||||
|
|
||||||
mock_client_instance.send_email.assert_called_once_with(
|
# Retrieve the email details from the arguments
|
||||||
FromEmailAddress=settings.DEFAULT_FROM_EMAIL,
|
from_email = kwargs.get("FromEmailAddress")
|
||||||
Destination={"ToAddresses": [EMAIL]},
|
to_email = kwargs["Destination"]["ToAddresses"][0]
|
||||||
Content=ANY,
|
email_content = kwargs["Content"]
|
||||||
)
|
email_body = email_content['Simple']['Body']['Text']['Data']
|
||||||
|
|
||||||
|
# Assert or perform other checks on the email details
|
||||||
|
expected_string = "Your .gov domain request is being reviewed"
|
||||||
|
assert from_email == settings.DEFAULT_FROM_EMAIL
|
||||||
|
assert to_email == EMAIL
|
||||||
|
assert expected_string in email_body
|
||||||
|
|
||||||
|
# Perform assertions on the mock call itself
|
||||||
|
mock_client_instance.send_email.assert_called_once()
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
application.delete()
|
application.delete()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue