You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by lu...@redhat.com on 2012/12/04 09:42:31 UTC

[PATCH 3/6] CIMI tests: do not send any auth header if no user is set

From: David Lutterkort <lu...@redhat.com>

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

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
-- 
1.7.7.6