deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject [1/14] git commit: * tests/cimi/test_helper.rb (retrieve): accomodate responses w/o body
Date Tue, 11 Dec 2012 03:48:24 GMT
Updated Branches:
  refs/heads/master 1a1705079 -> af7a86844


* tests/cimi/test_helper.rb (retrieve): accomodate responses w/o body


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

Branch: refs/heads/master
Commit: fbe09df542b6cd2a5614dad78ce1d30bdcd87081
Parents: 402fd68
Author: David Lutterkort <lutter@redhat.com>
Authored: Wed Dec 5 16:10:07 2012 -0800
Committer: David Lutterkort <lutter@redhat.com>
Committed: Mon Dec 10 17:08:49 2012 -0800

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


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fbe09df5/tests/cimi/test_helper.rb
----------------------------------------------------------------------
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


Mime
View raw message