diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-12-23 14:49:14 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-12-23 14:49:14 +0000 |
commit | 07fe46e9dfc1567d24de4ff8799a1e1c048b2adc (patch) | |
tree | ed2102b2d574b90dc423b73765ff036d36ea28bd /test/test_helper.rb | |
parent | 283d25d82334c00f2cf70770f50ae5649e6d791f (diff) | |
download | redmine-07fe46e9dfc1567d24de4ff8799a1e1c048b2adc.tar.gz redmine-07fe46e9dfc1567d24de4ff8799a1e1c048b2adc.zip |
Makes the API accepts the X-Redmine-API-Key header to hold the API key.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4573 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r-- | test/test_helper.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb index 54681526a..be87c63f5 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -361,6 +361,20 @@ class ActiveSupport::TestCase end end + context "should allow key based auth using X-Redmine-API-Key header for #{http_method} #{url}" do + setup do + @user = User.generate_with_protected!(:admin => true) + @token = Token.generate!(:user => @user, :action => 'api') + send(http_method, url, parameters, {'X-Redmine-API-Key' => @token.value.to_s}) + end + + should_respond_with success_code + should_respond_with_content_type_based_on_url(url) + should_be_a_valid_response_string_based_on_url(url) + should "login as the user" do + assert_equal @user, User.current + end + end end # Uses should_respond_with_content_type based on what's in the url: |