mirror of
https://github.com/redmine/redmine.git
synced 2025-12-16 05:20:28 +01:00
fix source indent of MailHandlerTest
git-svn-id: http://svn.redmine.org/redmine/trunk@20210 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -113,11 +113,12 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_add_issue_to_project_specified_by_subaddress
|
def test_add_issue_to_project_specified_by_subaddress
|
||||||
# This email has redmine+onlinestore@somenet.foo as 'To' header
|
# This email has redmine+onlinestore@somenet.foo as 'To' header
|
||||||
issue = submit_email(
|
issue =
|
||||||
'ticket_on_project_given_by_to_header.eml',
|
submit_email(
|
||||||
:issue => {:tracker => 'Support request'},
|
'ticket_on_project_given_by_to_header.eml',
|
||||||
:project_from_subaddress => 'redmine@somenet.foo'
|
:issue => {:tracker => 'Support request'},
|
||||||
)
|
:project_from_subaddress => 'redmine@somenet.foo'
|
||||||
|
)
|
||||||
assert issue.is_a?(Issue)
|
assert issue.is_a?(Issue)
|
||||||
assert !issue.new_record?
|
assert !issue.new_record?
|
||||||
issue.reload
|
issue.reload
|
||||||
@@ -127,10 +128,11 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_add_issue_with_default_tracker
|
def test_add_issue_with_default_tracker
|
||||||
# This email contains: 'Project: onlinestore'
|
# This email contains: 'Project: onlinestore'
|
||||||
issue = submit_email(
|
issue =
|
||||||
'ticket_on_given_project.eml',
|
submit_email(
|
||||||
:issue => {:tracker => 'Support request'}
|
'ticket_on_given_project.eml',
|
||||||
)
|
:issue => {:tracker => 'Support request'}
|
||||||
|
)
|
||||||
assert issue.is_a?(Issue)
|
assert issue.is_a?(Issue)
|
||||||
assert !issue.new_record?
|
assert !issue.new_record?
|
||||||
issue.reload
|
issue.reload
|
||||||
@@ -139,10 +141,11 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_add_issue_with_default_version
|
def test_add_issue_with_default_version
|
||||||
# This email contains: 'Project: onlinestore'
|
# This email contains: 'Project: onlinestore'
|
||||||
issue = submit_email(
|
issue =
|
||||||
'ticket_on_given_project.eml',
|
submit_email(
|
||||||
:issue => {:fixed_version => 'Alpha'}
|
'ticket_on_given_project.eml',
|
||||||
)
|
:issue => {:fixed_version => 'Alpha'}
|
||||||
|
)
|
||||||
assert issue.is_a?(Issue)
|
assert issue.is_a?(Issue)
|
||||||
assert !issue.new_record?
|
assert !issue.new_record?
|
||||||
assert_equal 'Alpha', issue.reload.fixed_version.name
|
assert_equal 'Alpha', issue.reload.fixed_version.name
|
||||||
@@ -150,10 +153,11 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_add_issue_with_default_assigned_to
|
def test_add_issue_with_default_assigned_to
|
||||||
# This email contains: 'Project: onlinestore'
|
# This email contains: 'Project: onlinestore'
|
||||||
issue = submit_email(
|
issue =
|
||||||
'ticket_on_given_project.eml',
|
submit_email(
|
||||||
:issue => {:assigned_to => 'jsmith'}
|
'ticket_on_given_project.eml',
|
||||||
)
|
:issue => {:assigned_to => 'jsmith'}
|
||||||
|
)
|
||||||
assert issue.is_a?(Issue)
|
assert issue.is_a?(Issue)
|
||||||
assert !issue.new_record?
|
assert !issue.new_record?
|
||||||
assert_equal 'jsmith', issue.reload.assigned_to.login
|
assert_equal 'jsmith', issue.reload.assigned_to.login
|
||||||
@@ -189,11 +193,12 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_add_issue_with_partial_attributes_override
|
def test_add_issue_with_partial_attributes_override
|
||||||
issue = submit_email(
|
issue =
|
||||||
'ticket_with_attributes.eml',
|
submit_email(
|
||||||
:issue => {:priority => 'High'},
|
'ticket_with_attributes.eml',
|
||||||
:allow_override => ['tracker']
|
:issue => {:priority => 'High'},
|
||||||
)
|
:allow_override => ['tracker']
|
||||||
|
)
|
||||||
assert issue.is_a?(Issue)
|
assert issue.is_a?(Issue)
|
||||||
assert !issue.new_record?
|
assert !issue.new_record?
|
||||||
issue.reload
|
issue.reload
|
||||||
@@ -207,10 +212,11 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_add_issue_with_spaces_between_attribute_and_separator
|
def test_add_issue_with_spaces_between_attribute_and_separator
|
||||||
issue = submit_email(
|
issue =
|
||||||
'ticket_with_spaces_between_attribute_and_separator.eml',
|
submit_email(
|
||||||
:allow_override => 'tracker,category,priority'
|
'ticket_with_spaces_between_attribute_and_separator.eml',
|
||||||
)
|
:allow_override => 'tracker,category,priority'
|
||||||
|
)
|
||||||
assert issue.is_a?(Issue)
|
assert issue.is_a?(Issue)
|
||||||
assert !issue.new_record?
|
assert !issue.new_record?
|
||||||
issue.reload
|
issue.reload
|
||||||
@@ -316,11 +322,13 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_add_issue_by_unknown_user
|
def test_add_issue_by_unknown_user
|
||||||
assert_no_difference 'User.count' do
|
assert_no_difference 'User.count' do
|
||||||
assert_equal false,
|
assert_equal(
|
||||||
submit_email(
|
false,
|
||||||
'ticket_by_unknown_user.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'ticket_by_unknown_user.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -328,11 +336,12 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
Role.anonymous.add_permission!(:add_issues)
|
Role.anonymous.add_permission!(:add_issues)
|
||||||
Role.anonymous.add_permission!(:add_issue_watchers)
|
Role.anonymous.add_permission!(:add_issue_watchers)
|
||||||
assert_no_difference 'User.count' do
|
assert_no_difference 'User.count' do
|
||||||
issue = submit_email(
|
issue =
|
||||||
'ticket_by_unknown_user.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'},
|
'ticket_by_unknown_user.eml',
|
||||||
:unknown_user => 'accept'
|
:issue => {:project => 'ecookbook'},
|
||||||
)
|
:unknown_user => 'accept'
|
||||||
|
)
|
||||||
assert issue.is_a?(Issue)
|
assert issue.is_a?(Issue)
|
||||||
assert issue.author.anonymous?
|
assert issue.author.anonymous?
|
||||||
issue.reload
|
issue.reload
|
||||||
@@ -344,11 +353,12 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
def test_add_issue_by_anonymous_user_with_no_from_address
|
def test_add_issue_by_anonymous_user_with_no_from_address
|
||||||
Role.anonymous.add_permission!(:add_issues)
|
Role.anonymous.add_permission!(:add_issues)
|
||||||
assert_no_difference 'User.count' do
|
assert_no_difference 'User.count' do
|
||||||
issue = submit_email(
|
issue =
|
||||||
'ticket_by_empty_user.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'},
|
'ticket_by_empty_user.eml',
|
||||||
:unknown_user => 'accept'
|
:issue => {:project => 'ecookbook'},
|
||||||
)
|
:unknown_user => 'accept'
|
||||||
|
)
|
||||||
assert issue.is_a?(Issue)
|
assert issue.is_a?(Issue)
|
||||||
assert issue.author.anonymous?
|
assert issue.author.anonymous?
|
||||||
end
|
end
|
||||||
@@ -358,12 +368,14 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
Role.anonymous.add_permission!(:add_issues)
|
Role.anonymous.add_permission!(:add_issues)
|
||||||
assert_no_difference 'User.count' do
|
assert_no_difference 'User.count' do
|
||||||
assert_no_difference 'Issue.count' do
|
assert_no_difference 'Issue.count' do
|
||||||
assert_equal false,
|
assert_equal(
|
||||||
submit_email(
|
false,
|
||||||
'ticket_by_unknown_user.eml',
|
submit_email(
|
||||||
:issue => {:project => 'onlinestore'},
|
'ticket_by_unknown_user.eml',
|
||||||
:unknown_user => 'accept'
|
:issue => {:project => 'onlinestore'},
|
||||||
)
|
:unknown_user => 'accept'
|
||||||
|
)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -371,12 +383,13 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
def test_add_issue_by_anonymous_user_on_private_project_without_permission_check
|
def test_add_issue_by_anonymous_user_on_private_project_without_permission_check
|
||||||
assert_no_difference 'User.count' do
|
assert_no_difference 'User.count' do
|
||||||
assert_difference 'Issue.count' do
|
assert_difference 'Issue.count' do
|
||||||
issue = submit_email(
|
issue =
|
||||||
'ticket_by_unknown_user.eml',
|
submit_email(
|
||||||
:issue => {:project => 'onlinestore'},
|
'ticket_by_unknown_user.eml',
|
||||||
:no_permission_check => '1',
|
:issue => {:project => 'onlinestore'},
|
||||||
:unknown_user => 'accept'
|
:no_permission_check => '1',
|
||||||
)
|
:unknown_user => 'accept'
|
||||||
|
)
|
||||||
assert issue.is_a?(Issue)
|
assert issue.is_a?(Issue)
|
||||||
assert issue.author.anonymous?
|
assert issue.author.anonymous?
|
||||||
assert !issue.project.is_public?
|
assert !issue.project.is_public?
|
||||||
@@ -387,11 +400,12 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
def test_add_issue_by_created_user
|
def test_add_issue_by_created_user
|
||||||
Setting.default_language = 'en'
|
Setting.default_language = 'en'
|
||||||
assert_difference 'User.count' do
|
assert_difference 'User.count' do
|
||||||
issue = submit_email(
|
issue =
|
||||||
'ticket_by_unknown_user.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'},
|
'ticket_by_unknown_user.eml',
|
||||||
:unknown_user => 'create'
|
:issue => {:project => 'ecookbook'},
|
||||||
)
|
:unknown_user => 'create'
|
||||||
|
)
|
||||||
assert issue.is_a?(Issue)
|
assert issue.is_a?(Issue)
|
||||||
assert issue.author.active?
|
assert issue.author.active?
|
||||||
assert_equal 'john.doe@somenet.foo', issue.author.mail
|
assert_equal 'john.doe@somenet.foo', issue.author.mail
|
||||||
@@ -472,10 +486,11 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_add_issue_with_invalid_attributes
|
def test_add_issue_with_invalid_attributes
|
||||||
with_settings :default_issue_start_date_to_creation_date => '0' do
|
with_settings :default_issue_start_date_to_creation_date => '0' do
|
||||||
issue = submit_email(
|
issue =
|
||||||
'ticket_with_invalid_attributes.eml',
|
submit_email(
|
||||||
:allow_override => 'tracker,category,priority'
|
'ticket_with_invalid_attributes.eml',
|
||||||
)
|
:allow_override => 'tracker,category,priority'
|
||||||
|
)
|
||||||
assert issue.is_a?(Issue)
|
assert issue.is_a?(Issue)
|
||||||
assert !issue.new_record?
|
assert !issue.new_record?
|
||||||
issue.reload
|
issue.reload
|
||||||
@@ -490,11 +505,14 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_add_issue_with_invalid_project_should_be_assigned_to_default_project
|
def test_add_issue_with_invalid_project_should_be_assigned_to_default_project
|
||||||
issue = submit_email('ticket_on_given_project.eml',
|
issue =
|
||||||
:issue => {:project => 'ecookbook'},
|
submit_email(
|
||||||
:allow_override => 'project') do |email|
|
'ticket_on_given_project.eml',
|
||||||
email.gsub!(/^Project:.+$/, 'Project: invalid')
|
:issue => {:project => 'ecookbook'},
|
||||||
end
|
:allow_override => 'project'
|
||||||
|
) do |email|
|
||||||
|
email.gsub!(/^Project:.+$/, 'Project: invalid')
|
||||||
|
end
|
||||||
assert issue.is_a?(Issue)
|
assert issue.is_a?(Issue)
|
||||||
assert !issue.new_record?
|
assert !issue.new_record?
|
||||||
assert_equal 'ecookbook', issue.project.identifier
|
assert_equal 'ecookbook', issue.project.identifier
|
||||||
@@ -504,10 +522,11 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
User.find_by_mail('jsmith@somenet.foo').update_attribute 'language', 'fr'
|
User.find_by_mail('jsmith@somenet.foo').update_attribute 'language', 'fr'
|
||||||
# give the user permission to set issues private:
|
# give the user permission to set issues private:
|
||||||
MemberRole.create! member_id: 3, role_id: 1
|
MemberRole.create! member_id: 3, role_id: 1
|
||||||
issue = submit_email(
|
issue =
|
||||||
'ticket_with_localized_private_flag.eml',
|
submit_email(
|
||||||
:allow_override => 'is_private,tracker,category,priority'
|
'ticket_with_localized_private_flag.eml',
|
||||||
)
|
:allow_override => 'is_private,tracker,category,priority'
|
||||||
|
)
|
||||||
assert issue.is_a?(Issue)
|
assert issue.is_a?(Issue)
|
||||||
assert_not issue.new_record?
|
assert_not issue.new_record?
|
||||||
issue.reload
|
issue.reload
|
||||||
@@ -517,10 +536,11 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_add_issue_with_localized_attributes
|
def test_add_issue_with_localized_attributes
|
||||||
User.find_by_mail('jsmith@somenet.foo').update_attribute 'language', 'fr'
|
User.find_by_mail('jsmith@somenet.foo').update_attribute 'language', 'fr'
|
||||||
issue = submit_email(
|
issue =
|
||||||
'ticket_with_localized_attributes.eml',
|
submit_email(
|
||||||
:allow_override => 'tracker,category,priority'
|
'ticket_with_localized_attributes.eml',
|
||||||
)
|
:allow_override => 'tracker,category,priority'
|
||||||
|
)
|
||||||
assert issue.is_a?(Issue)
|
assert issue.is_a?(Issue)
|
||||||
assert !issue.new_record?
|
assert !issue.new_record?
|
||||||
issue.reload
|
issue.reload
|
||||||
@@ -536,21 +556,23 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
def test_add_issue_with_japanese_keywords
|
def test_add_issue_with_japanese_keywords
|
||||||
tracker = Tracker.generate!(:name => '開発')
|
tracker = Tracker.generate!(:name => '開発')
|
||||||
Project.find(1).trackers << tracker
|
Project.find(1).trackers << tracker
|
||||||
issue = submit_email(
|
issue =
|
||||||
'japanese_keywords_iso_2022_jp.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'},
|
'japanese_keywords_iso_2022_jp.eml',
|
||||||
:allow_override => 'tracker'
|
:issue => {:project => 'ecookbook'},
|
||||||
)
|
:allow_override => 'tracker'
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert_equal tracker, issue.tracker
|
assert_equal tracker, issue.tracker
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_add_issue_from_apple_mail
|
def test_add_issue_from_apple_mail
|
||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
issue = submit_email(
|
issue =
|
||||||
'apple_mail_with_attachment.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'apple_mail_with_attachment.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert_equal 1, issue.attachments.size
|
assert_equal 1, issue.attachments.size
|
||||||
|
|
||||||
@@ -564,10 +586,11 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_thunderbird_with_attachment_ja
|
def test_thunderbird_with_attachment_ja
|
||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
issue = submit_email(
|
issue =
|
||||||
'thunderbird_with_attachment_ja.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'thunderbird_with_attachment_ja.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert_equal 1, issue.attachments.size
|
assert_equal 1, issue.attachments.size
|
||||||
attachment = issue.attachments.first
|
attachment = issue.attachments.first
|
||||||
@@ -579,20 +602,22 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_invalid_utf8
|
def test_invalid_utf8
|
||||||
issue = submit_email(
|
issue =
|
||||||
'invalid_utf8.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'invalid_utf8.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert_equal 'Здравствуйте?', issue.description
|
assert_equal 'Здравствуйте?', issue.description
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_gmail_with_attachment_ja
|
def test_gmail_with_attachment_ja
|
||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
issue = submit_email(
|
issue =
|
||||||
'gmail_with_attachment_ja.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'gmail_with_attachment_ja.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert_equal 1, issue.attachments.size
|
assert_equal 1, issue.attachments.size
|
||||||
attachment = issue.attachments.first
|
attachment = issue.attachments.first
|
||||||
@@ -605,10 +630,11 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_thunderbird_with_attachment_latin1
|
def test_thunderbird_with_attachment_latin1
|
||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
issue = submit_email(
|
issue =
|
||||||
'thunderbird_with_attachment_iso-8859-1.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'thunderbird_with_attachment_iso-8859-1.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert_equal 1, issue.attachments.size
|
assert_equal 1, issue.attachments.size
|
||||||
u = +''
|
u = +''
|
||||||
@@ -624,10 +650,11 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_gmail_with_attachment_latin1
|
def test_gmail_with_attachment_latin1
|
||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
issue = submit_email(
|
issue =
|
||||||
'gmail_with_attachment_iso-8859-1.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'gmail_with_attachment_iso-8859-1.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert_equal 1, issue.attachments.size
|
assert_equal 1, issue.attachments.size
|
||||||
u = +''
|
u = +''
|
||||||
@@ -643,10 +670,11 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_mail_with_attachment_latin2
|
def test_mail_with_attachment_latin2
|
||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
issue = submit_email(
|
issue =
|
||||||
'ticket_with_text_attachment_iso-8859-2.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'ticket_with_text_attachment_iso-8859-2.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert_equal 1, issue.attachments.size
|
assert_equal 1, issue.attachments.size
|
||||||
attachment = issue.attachments.first
|
attachment = issue.attachments.first
|
||||||
@@ -659,10 +687,11 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_empty_attachment_should_not_be_imported
|
def test_empty_attachment_should_not_be_imported
|
||||||
issue = submit_email(
|
issue =
|
||||||
'ticket_with_empty_attachment.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'ticket_with_empty_attachment.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_equal 0, issue.attachments.size
|
assert_equal 0, issue.attachments.size
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -703,66 +732,73 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_add_issue_with_iso_8859_1_subject
|
def test_add_issue_with_iso_8859_1_subject
|
||||||
issue = submit_email(
|
issue =
|
||||||
'subject_as_iso-8859-1.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'subject_as_iso-8859-1.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert_equal 'Testmail from Webmail: ä ö ü...', issue.subject
|
assert_equal 'Testmail from Webmail: ä ö ü...', issue.subject
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_quoted_printable_utf8
|
def test_quoted_printable_utf8
|
||||||
issue = submit_email(
|
issue =
|
||||||
'quoted_printable_utf8.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'quoted_printable_utf8.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert_equal 'Freundliche Grüsse', issue.description
|
assert_equal 'Freundliche Grüsse', issue.description
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_gmail_iso8859_2
|
def test_gmail_iso8859_2
|
||||||
issue = submit_email(
|
issue =
|
||||||
'gmail-iso8859-2.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'gmail-iso8859-2.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert issue.description.include?('Na štriku se suši šosić.')
|
assert issue.description.include?('Na štriku se suši šosić.')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_add_issue_with_japanese_subject
|
def test_add_issue_with_japanese_subject
|
||||||
issue = submit_email(
|
issue =
|
||||||
'subject_japanese_1.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'subject_japanese_1.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert_equal 'テスト', issue.subject
|
assert_equal 'テスト', issue.subject
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_add_issue_with_korean_body
|
def test_add_issue_with_korean_body
|
||||||
issue = submit_email(
|
issue =
|
||||||
'body_ks_c_5601-1987.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'body_ks_c_5601-1987.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert_equal '고맙습니다.', issue.description
|
assert_equal '고맙습니다.', issue.description
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_add_issue_with_no_subject_header
|
def test_add_issue_with_no_subject_header
|
||||||
with_settings :default_language => 'en' do
|
with_settings :default_language => 'en' do
|
||||||
issue = submit_email(
|
issue =
|
||||||
'no_subject_header.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'no_subject_header.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert_equal "(no subject)", issue.subject
|
assert_equal "(no subject)", issue.subject
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_add_issue_with_mixed_japanese_subject
|
def test_add_issue_with_mixed_japanese_subject
|
||||||
issue = submit_email(
|
issue =
|
||||||
'subject_japanese_2.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'subject_japanese_2.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert_equal 'Re: テスト', issue.subject
|
assert_equal 'Re: テスト', issue.subject
|
||||||
end
|
end
|
||||||
@@ -772,10 +808,11 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
# defined in some vendor-extended variants such as ISO-2022-JP-MS.
|
# defined in some vendor-extended variants such as ISO-2022-JP-MS.
|
||||||
# This test makes sure that mail gem replaces an undefined characters
|
# This test makes sure that mail gem replaces an undefined characters
|
||||||
# with a replacement character instead of breaking the whole subject.
|
# with a replacement character instead of breaking the whole subject.
|
||||||
issue = submit_email(
|
issue =
|
||||||
'subject_japanese_3.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'}
|
'subject_japanese_3.eml',
|
||||||
)
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
assert_kind_of Issue, issue
|
assert_kind_of Issue, issue
|
||||||
assert_match /丸数字テスト/, issue.subject
|
assert_match /丸数字テスト/, issue.subject
|
||||||
end
|
end
|
||||||
@@ -799,12 +836,14 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
emission_addresses.each do |addr|
|
emission_addresses.each do |addr|
|
||||||
with_settings :mail_from => addr do
|
with_settings :mail_from => addr do
|
||||||
assert_no_difference 'User.count' do
|
assert_no_difference 'User.count' do
|
||||||
assert_equal false,
|
assert_equal(
|
||||||
submit_email(
|
false,
|
||||||
'ticket_from_emission_address.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'},
|
'ticket_from_emission_address.eml',
|
||||||
:unknown_user => 'create'
|
:issue => {:project => 'ecookbook'},
|
||||||
)
|
:unknown_user => 'create'
|
||||||
|
)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -946,10 +985,11 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_update_issue_should_not_set_defaults
|
def test_update_issue_should_not_set_defaults
|
||||||
journal = submit_email(
|
journal =
|
||||||
'ticket_reply.eml',
|
submit_email(
|
||||||
:issue => {:tracker => 'Support request', :priority => 'High'}
|
'ticket_reply.eml',
|
||||||
)
|
:issue => {:tracker => 'Support request', :priority => 'High'}
|
||||||
|
)
|
||||||
assert journal.is_a?(Journal)
|
assert journal.is_a?(Journal)
|
||||||
assert_match /This is reply/, journal.notes
|
assert_match /This is reply/, journal.notes
|
||||||
assert_equal 'Feature request', journal.issue.tracker.name
|
assert_equal 'Feature request', journal.issue.tracker.name
|
||||||
@@ -1236,11 +1276,12 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_new_user_with_utf8_encoded_fullname_should_be_decoded
|
def test_new_user_with_utf8_encoded_fullname_should_be_decoded
|
||||||
assert_difference 'User.count' do
|
assert_difference 'User.count' do
|
||||||
issue = submit_email(
|
issue =
|
||||||
'fullname_of_sender_as_utf8_encoded.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'},
|
'fullname_of_sender_as_utf8_encoded.eml',
|
||||||
:unknown_user => 'create'
|
:issue => {:project => 'ecookbook'},
|
||||||
)
|
:unknown_user => 'create'
|
||||||
|
)
|
||||||
end
|
end
|
||||||
user = User.order('id DESC').first
|
user = User.order('id DESC').first
|
||||||
assert_equal "foo@example.org", user.mail
|
assert_equal "foo@example.org", user.mail
|
||||||
@@ -1250,11 +1291,12 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_new_user_with_fullname_in_parentheses
|
def test_new_user_with_fullname_in_parentheses
|
||||||
assert_difference 'User.count' do
|
assert_difference 'User.count' do
|
||||||
issue = submit_email(
|
issue =
|
||||||
'fullname_of_sender_in_parentheses.eml',
|
submit_email(
|
||||||
:issue => {:project => 'ecookbook'},
|
'fullname_of_sender_in_parentheses.eml',
|
||||||
:unknown_user => 'create'
|
:issue => {:project => 'ecookbook'},
|
||||||
)
|
:unknown_user => 'create'
|
||||||
|
)
|
||||||
end
|
end
|
||||||
user = User.order('id DESC').first
|
user = User.order('id DESC').first
|
||||||
assert_equal "jdoe@example.net", user.mail
|
assert_equal "jdoe@example.net", user.mail
|
||||||
@@ -1263,17 +1305,20 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_extract_options_from_env_should_return_options
|
def test_extract_options_from_env_should_return_options
|
||||||
options = MailHandler.extract_options_from_env({
|
options =
|
||||||
'tracker' => 'defect',
|
MailHandler.extract_options_from_env(
|
||||||
'project' => 'foo',
|
{
|
||||||
'unknown_user' => 'create',
|
'tracker' => 'defect',
|
||||||
'no_notification' => '1'
|
'project' => 'foo',
|
||||||
})
|
'unknown_user' => 'create',
|
||||||
|
'no_notification' => '1'
|
||||||
assert_equal({
|
}
|
||||||
:issue => {:tracker => 'defect', :project => 'foo'},
|
)
|
||||||
:unknown_user => 'create', :no_notification => '1'
|
assert_equal(
|
||||||
}, options)
|
{:issue => {:tracker => 'defect', :project => 'foo'},
|
||||||
|
:unknown_user => 'create', :no_notification => '1'},
|
||||||
|
options
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_safe_receive_should_rescue_exceptions_and_return_false
|
def test_safe_receive_should_rescue_exceptions_and_return_false
|
||||||
|
|||||||
Reference in New Issue
Block a user