diff test/.svn/text-base/test_helper.rb.svn-base @ 117:af80e5618e9b redmine-1.1

* Update to Redmine 1.1-stable branch (Redmine SVN rev 4707)
author Chris Cannam
date Thu, 13 Jan 2011 12:53:21 +0000
parents 94944d00e43c
children cd2282d2aa55
line wrap: on
line diff
--- a/test/.svn/text-base/test_helper.rb.svn-base	Fri Nov 19 14:05:24 2010 +0000
+++ b/test/.svn/text-base/test_helper.rb.svn-base	Thu Jan 13 12:53:21 2011 +0000
@@ -115,7 +115,7 @@
   end
   
   def assert_error_tag(options={})
-    assert_tag({:tag => 'p', :attributes => { :id => 'errorExplanation' }}.merge(options))
+    assert_tag({:attributes => { :id => 'errorExplanation' }}.merge(options))
   end
 
   # Shoulda macros
@@ -361,6 +361,20 @@
       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: