SESv2 send_email(): Ensure email-body is persisted (#6913)

This commit is contained in:
Bert Blommers 2023-10-14 09:34:14 +00:00 committed by GitHub
parent 44fe39f584
commit 681f117b63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -46,7 +46,7 @@ class SESV2Response(BaseResponse):
source=from_email_address, source=from_email_address,
destinations=destination, destinations=destination,
subject=content["Simple"]["Subject"]["Data"], subject=content["Simple"]["Subject"]["Data"],
body=content["Simple"]["Subject"]["Data"], body=content["Simple"]["Body"]["Text"]["Data"],
) )
elif "Template" in content: elif "Template" in content:
raise NotImplementedError("Template functionality not ready") raise NotImplementedError("Template functionality not ready")

View File

@ -46,6 +46,12 @@ def test_send_email(ses_v1): # pylint: disable=redefined-outer-name
sent_count = int(send_quota["SentLast24Hours"]) sent_count = int(send_quota["SentLast24Hours"])
assert sent_count == 3 assert sent_count == 3
if not settings.TEST_SERVER_MODE:
backend = ses_backends[DEFAULT_ACCOUNT_ID]["us-east-1"]
msg: RawMessage = backend.sent_messages[0]
assert msg.subject == "test subject"
assert msg.body == "test body"
@mock_sesv2 @mock_sesv2
def test_send_raw_email(ses_v1): # pylint: disable=redefined-outer-name def test_send_raw_email(ses_v1): # pylint: disable=redefined-outer-name