You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by ma...@apache.org on 2012/12/04 16:39:56 UTC

[5/6] git commit: CIMI tests: do not send any auth header if no user is set

CIMI tests: do not send any auth header if no user is set

TrackedAt: http://tracker.deltacloud.org/patch/525ea5ce5ddafe83d7376584bc3817fe95110551


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/73759a0f
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/73759a0f
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/73759a0f

Branch: refs/heads/master
Commit: 73759a0fcc166638bb661224345cba79859aaa75
Parents: 0c8e828
Author: David Lutterkort <lu...@redhat.com>
Authored: Mon Dec 3 23:20:27 2012 -0800
Committer: marios <ma...@redhat.com>
Committed: Tue Dec 4 17:26:39 2012 +0200

----------------------------------------------------------------------
 tests/cimi/test_helper.rb |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/73759a0f/tests/cimi/test_helper.rb
----------------------------------------------------------------------
diff --git a/tests/cimi/test_helper.rb b/tests/cimi/test_helper.rb
index 009bac6..0e102c4 100644
--- a/tests/cimi/test_helper.rb
+++ b/tests/cimi/test_helper.rb
@@ -50,6 +50,14 @@ module CIMI
         "Basic #{Base64.encode64("#{u}:#{p}")}"
       end
 
+      def auth_header
+        if @cimi["user"]
+          { "Authorization" => basic_auth }
+        else
+          {}
+        end
+      end
+
       def preferred
         @cimi["preferred"] || {}
       end
@@ -164,9 +172,7 @@ module CIMI::Test::Methods
     end
 
     def headers(params)
-      headers = {
-        'Authorization' => api.basic_auth
-      }
+      headers = api.auth_header
       if params[:accept]
         headers["Accept"] = "application/#{params.delete(:accept)}"
       else