summaryrefslogtreecommitdiffstats
path: root/test/functional/sys_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-20 09:44:28 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-20 09:44:28 +0000
commitcf9bb2699fa146514b219e1fd3dce6e367f274ce (patch)
treeffe2c6f9760dd5ecb5b1b60f03dded9ec6c13166 /test/functional/sys_controller_test.rb
parent4398386c48bb70e99e543cca166f704853d3c664 (diff)
downloadredmine-cf9bb2699fa146514b219e1fd3dce6e367f274ce.tar.gz
redmine-cf9bb2699fa146514b219e1fd3dce6e367f274ce.zip
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
Diffstat (limited to 'test/functional/sys_controller_test.rb')
-rw-r--r--test/functional/sys_controller_test.rb21
1 files changed, 21 insertions, 0 deletions
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