use with_settings at MailHandlerControllerTest#test_should_not_allow_with_api_disabled

git-svn-id: http://svn.redmine.org/redmine/trunk@20561 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA
2020-12-03 13:20:34 +00:00
parent ba43634aab
commit 7c292dd23c

View File

@@ -122,17 +122,21 @@ class MailHandlerControllerTest < Redmine::ControllerTest
def test_should_not_allow_with_api_disabled def test_should_not_allow_with_api_disabled
# Disable API # Disable API
Setting.mail_handler_api_enabled = 0 with_settings(
Setting.mail_handler_api_key = 'secret' :mail_handler_api_enabled => 0,
:mail_handler_api_key => 'secret'
) do
assert_no_difference 'Issue.count' do assert_no_difference 'Issue.count' do
post( post(
:index, :index,
:params => { :params => {
:key => 'secret', :key => 'secret',
:email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')) :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
end end