add "assert_response 401" to tests (#16107)

git-svn-id: http://svn.redmine.org/redmine/trunk@12917 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2014-02-22 15:55:20 +00:00
parent 8405d57516
commit ad8c02ca82
1 changed files with 2 additions and 0 deletions

View File

@ -31,11 +31,13 @@ class Redmine::ApiTest::AuthenticationTest < Redmine::ApiTest::Base
def test_api_should_trigger_basic_http_auth_with_basic_authorization_header def test_api_should_trigger_basic_http_auth_with_basic_authorization_header
ApplicationController.any_instance.expects(:authenticate_with_http_basic).once ApplicationController.any_instance.expects(:authenticate_with_http_basic).once
get '/users/current.xml', {}, credentials('jsmith') get '/users/current.xml', {}, credentials('jsmith')
assert_response 401
end end
def test_api_should_not_trigger_basic_http_auth_with_non_basic_authorization_header def test_api_should_not_trigger_basic_http_auth_with_non_basic_authorization_header
ApplicationController.any_instance.expects(:authenticate_with_http_basic).never ApplicationController.any_instance.expects(:authenticate_with_http_basic).never
get '/users/current.xml', {}, 'HTTP_AUTHORIZATION' => 'Digest foo bar' get '/users/current.xml', {}, 'HTTP_AUTHORIZATION' => 'Digest foo bar'
assert_response 401
end end
def test_invalid_utf8_credentials_should_not_trigger_an_error def test_invalid_utf8_credentials_should_not_trigger_an_error