From cf9bb2699fa146514b219e1fd3dce6e367f274ce Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 20 Dec 2009 09:44:28 +0000 Subject: 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 --- test/functional/sys_controller_test.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/functional/sys_controller_test.rb') diff --git a/test/functional/sys_controller_test.rb b/test/functional/sys_controller_test.rb index 187fbe410..179740190 100644 --- a/test/functional/sys_controller_test.rb +++ b/test/functional/sys_controller_test.rb @@ -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 -- cgit v1.2.3