Better handle html-only emails (#16962).

git-svn-id: http://svn.redmine.org/redmine/trunk@14313 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2015-06-15 21:16:42 +00:00
parent 7fb35abd10
commit 3ae42cb326
14 changed files with 1312 additions and 19 deletions

View File

@@ -797,13 +797,33 @@ class MailHandlerTest < ActiveSupport::TestCase
assert_equal Message.find(1), m.parent
end
def test_should_strip_tags_of_html_only_emails
issue = submit_email('ticket_html_only.eml', :issue => {:project => 'ecookbook'})
def test_should_convert_tags_of_html_only_emails
with_settings :text_formatting => 'textile' do
issue = submit_email('ticket_html_only.eml', :issue => {:project => 'ecookbook'})
assert issue.is_a?(Issue)
assert !issue.new_record?
issue.reload
assert_equal 'HTML email', issue.subject
assert_equal "This is a *html-only* email.\r\n\r\nh1. With a title\r\n\r\nand a paragraph.", issue.description
end
end
def test_should_handle_outlook_web_access_2010_html_only
issue = submit_email('outlook_web_access_2010_html_only.eml', :issue => {:project => 'ecookbook'})
assert issue.is_a?(Issue)
assert !issue.new_record?
issue.reload
assert_equal 'HTML email', issue.subject
assert_equal 'This is a html-only email.', issue.description
assert_equal 'Upgrade Redmine to 3.0.x', issue.subject
assert_equal "A mess.\r\n\r\n--Geoff Maciolek\r\nMYCOMPANYNAME, LLC", issue.description
end
def test_should_handle_outlook_2010_html_only
issue = submit_email('outlook_2010_html_only.eml', :issue => {:project => 'ecookbook'})
assert issue.is_a?(Issue)
issue.reload
assert_equal 'Test email', issue.subject
assert_equal "Simple, unadorned test email generated by Outlook 2010. It is in HTML format, but" +
" no special formatting has been chosen. Im going to save this as a draft and then manually" +
" drop it into the Inbox for scraping by Redmine 3.0.2.", issue.description
end
test "truncate emails with no setting should add the entire email into the issue" do