Skip to content

Commit ff72ac9

Browse files
committed
[Py] Slight adaptations to new sendmail tests
1 parent 3c1639a commit ff72ac9

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

rosetta-test-py/sendmail-python-emails.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def sendmail_send_message(env, sender:SMTPBackend, message, sender_address, reci
132132
headers=custom_headers,)
133133
for attachment in attachments:
134134
message_properties = {
135-
"content_disposition": attachment.get("content-disposition", "attachment"),
135+
"content_disposition": attachment["content-disposition"],
136136
}
137137

138138
if "file-name" in attachment:
@@ -171,6 +171,9 @@ def sendmail_error(env, result: SMTPResponse):
171171
# python-emails does mitigation for addresses but detection for other fields
172172

173173
sendmail_suite.run(
174+
exclude=(
175+
# python-emails does not support attachments without a name
176+
"test_attachment_without_a_name",),
174177
exclude_capabilities=(
175178
"root.connection.lazy-connection", # TODO: python-emails does not handle failed auth correctly
176179
"root.connection.eager-connection",

rosetta-test-py/sendmail-redmail.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def sendmail_send_message(env, sender: EmailSender, message, sender_address, rec
137137
redmail_attachments = {
138138
attachment["file-name"]: pathlib.Path(rosetta.fixture_path('sendmail-fixtures/' + attachment["data"]))
139139
for attachment in attachments
140-
if attachment.get("content-disposition", "attachment") == "attachment"}
140+
if attachment["content-disposition"] == "attachment"}
141141
sender.send(sender=sender_address,
142142
receivers=recipient_addresses,
143143
cc=cc_addresses,
@@ -172,6 +172,16 @@ def sendmail_error(env, result):
172172

173173
sendmail_suite.run(
174174
exclude=(
175+
# redmail does not support inline disposition
176+
"test_text_attachment_with_inline_disposition",
177+
"test_image_attachment_with_inline_disposition",
178+
179+
# redmail does not support attachments without a filename
180+
"test_attachment_without_a_name",
181+
182+
# redmail does not support multiple attachments with the same name
183+
"test_multiple_attachments_with_same_name",
184+
175185
"test_CRLF_detection_in_send-message_recipient",
176186
"test_CRLF_mitigation_in_send-message_sender",
177187
"test_Connect_with_invalid_credentials"), # TODO redmail leaks sockets when credentials are invalid

0 commit comments

Comments
 (0)