diff options
author | Go MAEDA <maeda@farend.jp> | 2019-08-26 04:18:18 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2019-08-26 04:18:18 +0000 |
commit | 47dd2083f7958ff05deea3c56c1c2067fef64f9c (patch) | |
tree | a0386a6d30d3475a4788336593998813a5ec9ad8 /test | |
parent | e03617881e5f4c1240b9d494df975968da4a9478 (diff) | |
download | redmine-47dd2083f7958ff05deea3c56c1c2067fef64f9c.tar.gz redmine-47dd2083f7958ff05deea3c56c1c2067fef64f9c.zip |
Reject setting RFC non-compliant emission email addresses (#31154).
Patch by Mizuki ISHIKAWA.
git-svn-id: http://svn.redmine.org/redmine/trunk@18396 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/setting_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/setting_test.rb b/test/unit/setting_test.rb index 3d9252adb..253f3c037 100644 --- a/test/unit/setting_test.rb +++ b/test/unit/setting_test.rb @@ -132,4 +132,18 @@ YAML Setting.where(:name => 'commit_update_keywords').delete_all Setting.clear_cache end + + def test_mail_from_format_should_be_validated + with_settings :default_language => 'en' do + ['[Redmine app] <redmine@example.net>', 'redmine'].each do |invalid_mail_from| + errors = Setting.set_all_from_params({:mail_from => invalid_mail_from}) + assert_includes errors, [:mail_from, 'is invalid'] + end + + ['Redmine app <redmine@example.net>', 'redmine@example.net', '<redmine@example.net>'].each do |valid_mail_from| + errors = Setting.set_all_from_params({:mail_from => valid_mail_from}) + assert_nil errors + end + end + end end |