Skip to content

Commit 07a2cf3

Browse files
test(parser): cover optional SES common headers including replyTo (#8525)
1 parent 4624628 commit 07a2cf3

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎tests/unit/parser/_pydantic/test_ses.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,25 @@ def test_ses_reply_to_header():
9595
reply_to=["reply-kwarg@example.com"],
9696
)
9797
assert headers_kwarg.reply_to == ["reply-kwarg@example.com"]
98+
99+
100+
def test_ses_trigger_event_with_optional_common_headers():
101+
# GIVEN an SES event with cc, bcc, sender and reply-to common headers
102+
raw_event = load_event("sesEvent.json")
103+
raw_event["Records"][0]["ses"]["mail"]["commonHeaders"].update(
104+
{
105+
"cc": ["cc@example.com"],
106+
"bcc": ["bcc@example.com"],
107+
"sender": ["sender@example.com"],
108+
"replyTo": ["reply@example.com"],
109+
},
110+
)
111+
112+
# WHEN parsing the event
113+
common_headers = SesModel(**raw_event).Records[0].ses.mail.commonHeaders
114+
115+
# THEN the optional common headers are populated
116+
assert common_headers.cc == ["cc@example.com"]
117+
assert common_headers.bcc == ["bcc@example.com"]
118+
assert common_headers.sender == ["sender@example.com"]
119+
assert common_headers.reply_to == ["reply@example.com"]

0 commit comments

Comments
 (0)