Adds on optional API key to repositories management controller and reposman.rb.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3201 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-12-20 09:44:28 +00:00
parent 4398386c48
commit cf9bb2699f
5 changed files with 51 additions and 13 deletions

View File

@@ -68,4 +68,25 @@ class SysControllerTest < ActionController::TestCase
get :fetch_changesets, :id => 'unknown'
assert_response 404
end
def test_disabled_ws_should_respond_with_403_error
with_settings :sys_api_enabled => '0' do
get :projects
assert_response 403
end
end
def test_api_key
with_settings :sys_api_key => 'my_secret_key' do
get :projects, :key => 'my_secret_key'
assert_response :success
end
end
def test_wrong_key_should_respond_with_403_error
with_settings :sys_api_enabled => 'my_secret_key' do
get :projects, :key => 'wrong_key'
assert_response 403
end
end
end