diff options
author | Go MAEDA <maeda@farend.jp> | 2020-04-30 09:00:06 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2020-04-30 09:00:06 +0000 |
commit | 94c62816a52c13e1cdb91aab6f26c4798897b4a5 (patch) | |
tree | 6df427ce135df8554fc6ded0b95bf2860caaaa2b /test/functional/email_addresses_controller_test.rb | |
parent | d94226dd4ccc5757a94f3fe1542cdd736831fd48 (diff) | |
download | redmine-94c62816a52c13e1cdb91aab6f26c4798897b4a5.tar.gz redmine-94c62816a52c13e1cdb91aab6f26c4798897b4a5.zip |
Allowed/Disallowed email domains settings to restrict users' email addresses (#3369).
Patch by Yuichi HARADA and Go MAEDA.
git-svn-id: http://svn.redmine.org/redmine/trunk@19735 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/email_addresses_controller_test.rb')
-rw-r--r-- | test/functional/email_addresses_controller_test.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/functional/email_addresses_controller_test.rb b/test/functional/email_addresses_controller_test.rb index 76ff0a561..deb996105 100644 --- a/test/functional/email_addresses_controller_test.rb +++ b/test/functional/email_addresses_controller_test.rb @@ -118,6 +118,36 @@ class EmailAddressesControllerTest < Redmine::ControllerTest end end + def test_create_with_disallowed_domain_should_fail + @request.session[:user_id] = 2 + + with_settings :email_domains_denied => 'black.example' do + assert_no_difference 'EmailAddress.count' do + post :create, :params => { + :user_id => 2, + :email_address => { + :address => 'another@black.example' + } + } + assert_response :success + assert_select_error 'Email is invalid' + end + end + + with_settings :email_domains_allowed => 'white.example' do + assert_no_difference 'EmailAddress.count' do + post :create, :params => { + :user_id => 2, + :email_address => { + :address => 'something@example.fr' + } + } + assert_response :success + assert_select_error 'Email is invalid' + end + end + end + def test_create_should_send_security_notification @request.session[:user_id] = 2 ActionMailer::Base.deliveries.clear |