Merged r17878 and r17879 from trunk to 4.0-stable (#30785).

git-svn-id: http://svn.redmine.org/redmine/branches/4.0-stable@17880 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2019-02-18 13:51:26 +00:00
parent 222546ad6e
commit 514e8b9112
4 changed files with 18 additions and 31 deletions

View File

@@ -765,14 +765,23 @@ class MailHandlerTest < ActiveSupport::TestCase
end
def test_should_ignore_emails_from_emission_address
emission_addresses = [
'redmine@example.net',
'Redmine <redmine@example.net>',
'redmine@example.net (Redmine)'
]
Role.anonymous.add_permission!(:add_issues)
assert_no_difference 'User.count' do
assert_equal false,
submit_email(
'ticket_from_emission_address.eml',
:issue => {:project => 'ecookbook'},
:unknown_user => 'create'
)
emission_addresses.each do |addr|
with_settings :mail_from => addr do
assert_no_difference 'User.count' do
assert_equal false,
submit_email(
'ticket_from_emission_address.eml',
:issue => {:project => 'ecookbook'},
:unknown_user => 'create'
)
end
end
end
end

View File

@@ -108,23 +108,6 @@ class SettingTest < ActiveSupport::TestCase
end
end
def test_mail_from_address
mail_from_strings = [
'joe@example.com',
'<joe@example.com>',
'Joe Bloggs <joe@example.com>',
'display_name@example.com <joe@example.com>',
'joe@example.com (Joe Bloggs)',
'joe@example.com (display_name@example.com)'
]
mail_from_strings.each do |from_value|
with_settings :mail_from => from_value do
assert_equal 'joe@example.com', Setting.mail_from_address
end
end
end
def test_setting_serialied_as_binary_should_be_loaded_as_utf8_encoded_strings
yaml = <<-YAML
---