1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 23:11:12 +00:00

use with_settings at MailHandlerControllerTest#test_should_not_allow_with_wrong_key

git-svn-id: http://svn.redmine.org/redmine/trunk@20575 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2020-12-04 14:00:01 +00:00
parent 1b111f9389
commit bef2644f88

View File

@ -142,16 +142,20 @@ class MailHandlerControllerTest < Redmine::ControllerTest
end end
def test_should_not_allow_with_wrong_key def test_should_not_allow_with_wrong_key
Setting.mail_handler_api_enabled = 1 with_settings(
Setting.mail_handler_api_key = 'secret' :mail_handler_api_enabled => 1,
assert_no_difference 'Issue.count' do :mail_handler_api_key => 'secret'
post( ) do
:index, assert_no_difference 'Issue.count' do
:params => { post(
:key => 'wrong', :index,
:email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')) :params => {
} :key => 'wrong',
) :email =>
IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
}
)
end
end end
assert_response 403 assert_response 403
assert_include 'Access denied', response.body assert_include 'Access denied', response.body