Follow up for issue #2087 - improved tests - No mime_type on nil message (no message body) / email will not be processed.
This commit is contained in:
parent
3186d5e4d7
commit
7bdec55960
2 changed files with 18 additions and 3 deletions
7
test/data/mail/mail067.yml
Normal file
7
test/data/mail/mail067.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
|
||||||
|
from: Bob Smith | deal <info@example.de>
|
||||||
|
from_email: info@example.de
|
||||||
|
from_display_name: Bob Smith | deal
|
||||||
|
subject: Testmail - Alias in info@example.de Gruppe
|
||||||
|
content_type: text/plain
|
||||||
|
body: no visible content
|
|
@ -17,9 +17,17 @@ class EmailParserTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
messages.each do |m|
|
messages.each do |m|
|
||||||
# assert: raw content hash is a subset of parsed message hash
|
# assert: raw content hash is a subset of parsed message hash
|
||||||
assert_operator(m[:content].except(:attachments), :<=, m[:parsed],
|
expected_msg = m[:content].except(:attachments)
|
||||||
"parsed message data from #{m[:source]} does not match " \
|
parsed_msg = m[:parsed].slice(*expected_msg.keys)
|
||||||
"message content from #{m[:source].ext('yml')}")
|
failure_msg = [parsed_msg, expected_msg]
|
||||||
|
.map(&:to_a).map(&:sort).reduce(&:zip)
|
||||||
|
.reject { |a| a.uniq.one? }
|
||||||
|
.map { |a, b| "#{a.first.upcase}\n #{m[:source]}: #{a.last}\n #{m[:source].ext('yml')}: #{b.last}" }
|
||||||
|
.join("\n")
|
||||||
|
|
||||||
|
assert_operator(expected_msg, :<=, parsed_msg,
|
||||||
|
"parsed message data does not match message content:\n" +
|
||||||
|
failure_msg)
|
||||||
|
|
||||||
# assert: attachments in parsed message hash match metadata in raw hash
|
# assert: attachments in parsed message hash match metadata in raw hash
|
||||||
next if m[:content][:attachments].blank?
|
next if m[:content][:attachments].blank?
|
||||||
|
|
Loading…
Reference in a new issue