deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@redhat.com
Subject [PATCH 11/13] * tests/cimi/test_helper.rb (retrieve): accomodate responses w/o body
Date Thu, 06 Dec 2012 02:42:55 GMT
From: David Lutterkort <lutter@redhat.com>

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

diff --git a/tests/cimi/test_helper.rb b/tests/cimi/test_helper.rb
index b19dd9e..9df8000 100644
--- a/tests/cimi/test_helper.rb
+++ b/tests/cimi/test_helper.rb
@@ -163,7 +163,7 @@ module CIMI::Test::Methods
           resource = resp.xml.root.name
         end
       else
-        raise "Unexpected content type #{response.content_type}"
+        raise "Unexpected content type #{resp.content_type}"
       end
       CIMI::Model::const_get(resource)
     end
@@ -380,6 +380,8 @@ end
 class CIMI::Test::Spec < MiniTest::Spec
   include CIMI::Test::Methods
 
+  attr_reader :format, :content_type
+
   CONTENT_TYPES = { :xml => "application/xml",
     :json => "application/json" }
 
@@ -460,9 +462,11 @@ class CIMI::Test::Spec < MiniTest::Spec
 
   def retrieve(k, &block)
     response = instance_exec(@format, &block)
-    assert_equal @content_type, response.content_type
-    if @format == :xml
-      response.xml.namespaces["xmlns"].must_equal CIMI::Test::CIMI_NAMESPACE
+    if response.body && response.body.size > 0
+      assert_equal @content_type, response.content_type
+      if @format == :xml
+        response.xml.namespaces["xmlns"].must_equal CIMI::Test::CIMI_NAMESPACE
+      end
     end
     response
   end
-- 
1.7.7.6


Mime
View raw message