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:
Toshi MARUYAMA
2020-10-27 15:18:41 +00:00
parent 2719f85222
commit c866eb56fb

View File

@@ -113,7 +113,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_add_issue_to_project_specified_by_subaddress
# This email has redmine+onlinestore@somenet.foo as 'To' header
issue = submit_email(
issue =
submit_email(
'ticket_on_project_given_by_to_header.eml',
:issue => {:tracker => 'Support request'},
:project_from_subaddress => 'redmine@somenet.foo'
@@ -127,7 +128,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_add_issue_with_default_tracker
# This email contains: 'Project: onlinestore'
issue = submit_email(
issue =
submit_email(
'ticket_on_given_project.eml',
:issue => {:tracker => 'Support request'}
)
@@ -139,7 +141,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_add_issue_with_default_version
# This email contains: 'Project: onlinestore'
issue = submit_email(
issue =
submit_email(
'ticket_on_given_project.eml',
:issue => {:fixed_version => 'Alpha'}
)
@@ -150,7 +153,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_add_issue_with_default_assigned_to
# This email contains: 'Project: onlinestore'
issue = submit_email(
issue =
submit_email(
'ticket_on_given_project.eml',
:issue => {:assigned_to => 'jsmith'}
)
@@ -189,7 +193,8 @@ class MailHandlerTest < ActiveSupport::TestCase
end
def test_add_issue_with_partial_attributes_override
issue = submit_email(
issue =
submit_email(
'ticket_with_attributes.eml',
:issue => {:priority => 'High'},
:allow_override => ['tracker']
@@ -207,7 +212,8 @@ class MailHandlerTest < ActiveSupport::TestCase
end
def test_add_issue_with_spaces_between_attribute_and_separator
issue = submit_email(
issue =
submit_email(
'ticket_with_spaces_between_attribute_and_separator.eml',
:allow_override => 'tracker,category,priority'
)
@@ -316,11 +322,13 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_add_issue_by_unknown_user
assert_no_difference 'User.count' do
assert_equal false,
assert_equal(
false,
submit_email(
'ticket_by_unknown_user.eml',
:issue => {:project => 'ecookbook'}
)
)
end
end
@@ -328,7 +336,8 @@ class MailHandlerTest < ActiveSupport::TestCase
Role.anonymous.add_permission!(:add_issues)
Role.anonymous.add_permission!(:add_issue_watchers)
assert_no_difference 'User.count' do
issue = submit_email(
issue =
submit_email(
'ticket_by_unknown_user.eml',
:issue => {:project => 'ecookbook'},
:unknown_user => 'accept'
@@ -344,7 +353,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_add_issue_by_anonymous_user_with_no_from_address
Role.anonymous.add_permission!(:add_issues)
assert_no_difference 'User.count' do
issue = submit_email(
issue =
submit_email(
'ticket_by_empty_user.eml',
:issue => {:project => 'ecookbook'},
:unknown_user => 'accept'
@@ -358,12 +368,14 @@ class MailHandlerTest < ActiveSupport::TestCase
Role.anonymous.add_permission!(:add_issues)
assert_no_difference 'User.count' do
assert_no_difference 'Issue.count' do
assert_equal false,
assert_equal(
false,
submit_email(
'ticket_by_unknown_user.eml',
:issue => {:project => 'onlinestore'},
:unknown_user => 'accept'
)
)
end
end
end
@@ -371,7 +383,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_add_issue_by_anonymous_user_on_private_project_without_permission_check
assert_no_difference 'User.count' do
assert_difference 'Issue.count' do
issue = submit_email(
issue =
submit_email(
'ticket_by_unknown_user.eml',
:issue => {:project => 'onlinestore'},
:no_permission_check => '1',
@@ -387,7 +400,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_add_issue_by_created_user
Setting.default_language = 'en'
assert_difference 'User.count' do
issue = submit_email(
issue =
submit_email(
'ticket_by_unknown_user.eml',
:issue => {:project => 'ecookbook'},
:unknown_user => 'create'
@@ -472,7 +486,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_add_issue_with_invalid_attributes
with_settings :default_issue_start_date_to_creation_date => '0' do
issue = submit_email(
issue =
submit_email(
'ticket_with_invalid_attributes.eml',
:allow_override => 'tracker,category,priority'
)
@@ -490,9 +505,12 @@ class MailHandlerTest < ActiveSupport::TestCase
end
def test_add_issue_with_invalid_project_should_be_assigned_to_default_project
issue = submit_email('ticket_on_given_project.eml',
issue =
submit_email(
'ticket_on_given_project.eml',
:issue => {:project => 'ecookbook'},
:allow_override => 'project') do |email|
:allow_override => 'project'
) do |email|
email.gsub!(/^Project:.+$/, 'Project: invalid')
end
assert issue.is_a?(Issue)
@@ -504,7 +522,8 @@ class MailHandlerTest < ActiveSupport::TestCase
User.find_by_mail('jsmith@somenet.foo').update_attribute 'language', 'fr'
# give the user permission to set issues private:
MemberRole.create! member_id: 3, role_id: 1
issue = submit_email(
issue =
submit_email(
'ticket_with_localized_private_flag.eml',
:allow_override => 'is_private,tracker,category,priority'
)
@@ -517,7 +536,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_add_issue_with_localized_attributes
User.find_by_mail('jsmith@somenet.foo').update_attribute 'language', 'fr'
issue = submit_email(
issue =
submit_email(
'ticket_with_localized_attributes.eml',
:allow_override => 'tracker,category,priority'
)
@@ -536,7 +556,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_add_issue_with_japanese_keywords
tracker = Tracker.generate!(:name => '開発')
Project.find(1).trackers << tracker
issue = submit_email(
issue =
submit_email(
'japanese_keywords_iso_2022_jp.eml',
:issue => {:project => 'ecookbook'},
:allow_override => 'tracker'
@@ -547,7 +568,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_add_issue_from_apple_mail
set_tmp_attachments_directory
issue = submit_email(
issue =
submit_email(
'apple_mail_with_attachment.eml',
:issue => {:project => 'ecookbook'}
)
@@ -564,7 +586,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_thunderbird_with_attachment_ja
set_tmp_attachments_directory
issue = submit_email(
issue =
submit_email(
'thunderbird_with_attachment_ja.eml',
:issue => {:project => 'ecookbook'}
)
@@ -579,7 +602,8 @@ class MailHandlerTest < ActiveSupport::TestCase
end
def test_invalid_utf8
issue = submit_email(
issue =
submit_email(
'invalid_utf8.eml',
:issue => {:project => 'ecookbook'}
)
@@ -589,7 +613,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_gmail_with_attachment_ja
set_tmp_attachments_directory
issue = submit_email(
issue =
submit_email(
'gmail_with_attachment_ja.eml',
:issue => {:project => 'ecookbook'}
)
@@ -605,7 +630,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_thunderbird_with_attachment_latin1
set_tmp_attachments_directory
issue = submit_email(
issue =
submit_email(
'thunderbird_with_attachment_iso-8859-1.eml',
:issue => {:project => 'ecookbook'}
)
@@ -624,7 +650,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_gmail_with_attachment_latin1
set_tmp_attachments_directory
issue = submit_email(
issue =
submit_email(
'gmail_with_attachment_iso-8859-1.eml',
:issue => {:project => 'ecookbook'}
)
@@ -643,7 +670,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_mail_with_attachment_latin2
set_tmp_attachments_directory
issue = submit_email(
issue =
submit_email(
'ticket_with_text_attachment_iso-8859-2.eml',
:issue => {:project => 'ecookbook'}
)
@@ -659,7 +687,8 @@ class MailHandlerTest < ActiveSupport::TestCase
end
def test_empty_attachment_should_not_be_imported
issue = submit_email(
issue =
submit_email(
'ticket_with_empty_attachment.eml',
:issue => {:project => 'ecookbook'}
)
@@ -703,7 +732,8 @@ class MailHandlerTest < ActiveSupport::TestCase
end
def test_add_issue_with_iso_8859_1_subject
issue = submit_email(
issue =
submit_email(
'subject_as_iso-8859-1.eml',
:issue => {:project => 'ecookbook'}
)
@@ -712,7 +742,8 @@ class MailHandlerTest < ActiveSupport::TestCase
end
def test_quoted_printable_utf8
issue = submit_email(
issue =
submit_email(
'quoted_printable_utf8.eml',
:issue => {:project => 'ecookbook'}
)
@@ -721,7 +752,8 @@ class MailHandlerTest < ActiveSupport::TestCase
end
def test_gmail_iso8859_2
issue = submit_email(
issue =
submit_email(
'gmail-iso8859-2.eml',
:issue => {:project => 'ecookbook'}
)
@@ -730,7 +762,8 @@ class MailHandlerTest < ActiveSupport::TestCase
end
def test_add_issue_with_japanese_subject
issue = submit_email(
issue =
submit_email(
'subject_japanese_1.eml',
:issue => {:project => 'ecookbook'}
)
@@ -739,7 +772,8 @@ class MailHandlerTest < ActiveSupport::TestCase
end
def test_add_issue_with_korean_body
issue = submit_email(
issue =
submit_email(
'body_ks_c_5601-1987.eml',
:issue => {:project => 'ecookbook'}
)
@@ -749,7 +783,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_add_issue_with_no_subject_header
with_settings :default_language => 'en' do
issue = submit_email(
issue =
submit_email(
'no_subject_header.eml',
:issue => {:project => 'ecookbook'}
)
@@ -759,7 +794,8 @@ class MailHandlerTest < ActiveSupport::TestCase
end
def test_add_issue_with_mixed_japanese_subject
issue = submit_email(
issue =
submit_email(
'subject_japanese_2.eml',
:issue => {:project => 'ecookbook'}
)
@@ -772,7 +808,8 @@ class MailHandlerTest < ActiveSupport::TestCase
# defined in some vendor-extended variants such as ISO-2022-JP-MS.
# This test makes sure that mail gem replaces an undefined characters
# with a replacement character instead of breaking the whole subject.
issue = submit_email(
issue =
submit_email(
'subject_japanese_3.eml',
:issue => {:project => 'ecookbook'}
)
@@ -799,12 +836,14 @@ class MailHandlerTest < ActiveSupport::TestCase
emission_addresses.each do |addr|
with_settings :mail_from => addr do
assert_no_difference 'User.count' do
assert_equal false,
assert_equal(
false,
submit_email(
'ticket_from_emission_address.eml',
:issue => {:project => 'ecookbook'},
:unknown_user => 'create'
)
)
end
end
end
@@ -946,7 +985,8 @@ class MailHandlerTest < ActiveSupport::TestCase
end
def test_update_issue_should_not_set_defaults
journal = submit_email(
journal =
submit_email(
'ticket_reply.eml',
:issue => {:tracker => 'Support request', :priority => 'High'}
)
@@ -1236,7 +1276,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_new_user_with_utf8_encoded_fullname_should_be_decoded
assert_difference 'User.count' do
issue = submit_email(
issue =
submit_email(
'fullname_of_sender_as_utf8_encoded.eml',
:issue => {:project => 'ecookbook'},
:unknown_user => 'create'
@@ -1250,7 +1291,8 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_new_user_with_fullname_in_parentheses
assert_difference 'User.count' do
issue = submit_email(
issue =
submit_email(
'fullname_of_sender_in_parentheses.eml',
:issue => {:project => 'ecookbook'},
:unknown_user => 'create'
@@ -1263,17 +1305,20 @@ class MailHandlerTest < ActiveSupport::TestCase
end
def test_extract_options_from_env_should_return_options
options = MailHandler.extract_options_from_env({
options =
MailHandler.extract_options_from_env(
{
'tracker' => 'defect',
'project' => 'foo',
'unknown_user' => 'create',
'no_notification' => '1'
})
assert_equal({
:issue => {:tracker => 'defect', :project => 'foo'},
:unknown_user => 'create', :no_notification => '1'
}, options)
}
)
assert_equal(
{:issue => {:tracker => 'defect', :project => 'foo'},
:unknown_user => 'create', :no_notification => '1'},
options
)
end
def test_safe_receive_should_rescue_exceptions_and_return_false