Skip to content

Commit

Permalink
add a test case for 8bit attachment without GPG
Browse files Browse the repository at this point in the history
This is the opposite behaviour to the test case added in the previous
commit (the attachment goes in unmodified).
  • Loading branch information
danc86 committed Jul 7, 2024
1 parent f16d473 commit f3b6312
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion test/unit/test_edit_message_mode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,34 @@ def teardown
$config = nil
end

def test_attachment_content_transfer_encoding_signed
def test_attachment_content_transfer_encoding
## RMail::Message#make_attachment will choose
## Content-Transfer-Encoding: 8bit for a CSV file.
## If we're not GPG signing or encrypting then the attachment will be sent
## as is. Note this assumes the SMTP servers in the delivery path all
## support the 8BITMIME extension.
attachment_content = "löl,\ntest,\n"
attachment_filename = File.join @path, "dummy.csv"
File.write attachment_filename, attachment_content

opts = {
:header => {
"From" => "[email protected]",
"To" => "[email protected]",
},
:attachments => {
"dummy.csv" => RMail::Message.make_file_attachment(attachment_filename),
},
}
mode = Redwood::EditMessageMode.new opts

msg = mode.send :build_message, Time.now
attachment = msg.part(1)
assert_equal attachment_content, attachment.body
assert_equal "8bit", attachment.header["Content-Transfer-Encoding"]
end

def test_attachment_content_transfer_encoding_signed
attachment_filename = File.join @path, "dummy.csv"
## Include some high bytes in the attachment contents in order to
## exercise quote-printable transfer encoding.
Expand Down

0 comments on commit f3b6312

Please sign in to comment.