deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject [4/14] git commit: CIMI tests: various fixes for part4
Date Tue, 11 Dec 2012 03:48:25 GMT
CIMI tests: various fixes for part4

  * do not rely on responses for create having body
  * fix name of Volume/MachineCreate XML
  * add XML namespaces as appropriate


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

Branch: refs/heads/master
Commit: af7a86844b06c19142b75855c59b01f8ff44ce06
Parents: 19835c0
Author: David Lutterkort <lutter@redhat.com>
Authored: Wed Dec 5 20:56:45 2012 -0800
Committer: David Lutterkort <lutter@redhat.com>
Committed: Mon Dec 10 17:08:49 2012 -0800

----------------------------------------------------------------------
 tests/cimi/part4_test.rb |   25 +++++++++++++------------
 tests/helpers/common.rb  |    4 ++++
 2 files changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/af7a8684/tests/cimi/part4_test.rb
----------------------------------------------------------------------
diff --git a/tests/cimi/part4_test.rb b/tests/cimi/part4_test.rb
index c6848c2..5727956 100644
--- a/tests/cimi/part4_test.rb
+++ b/tests/cimi/part4_test.rb
@@ -66,22 +66,23 @@ class AddVolumeToMachine < CIMI::Test::Spec
                   {:accept => :json, :content_type => :xml})
 
   # 4.3:  Create a new Volume
-  model :volume do |fmt|
+  model :volume, :cache => true do |fmt|
     volume_add_uri = discover_uri_for("add", "volumes")
-    post(volume_add_uri,
-      "<Volume>" +
+    resp = post(volume_add_uri,
+      "<VolumeCreate xmlns=\"#{CIMI::Test::CIMI_NAMESPACE}\">" +
         "<name>cimi_volume_" + fmt.to_s() +"</name>" +
         "<description>volume for testing</description>" +
         "<volumeTemplate>" +
           "<volumeConfig href=\"" + get_a(cep_json, "volumeConfig") + "\">" +
           "</volumeConfig>" +
         "</volumeTemplate>" +
-      "</Volume>",
+      "</VolumeCreate>",
          :accept => fmt, :content_type => :xml)
+    get resp.location
   end
 
   it "should add resource machine resource for cleanup", :only => :json do
-    @@created_resources[:machines] << machine.json["id"]
+    @@created_resources[:machines] << machine.location
   end
 
 #  it "should add resource for cleanup" do
@@ -104,27 +105,27 @@ class AddVolumeToMachine < CIMI::Test::Spec
     last_response.json["resourceURI"].must_equal RESOURCE_URI.gsub("Create", "")
   end
 
-  log.info(machine.json["id"].to_s() + " is the machine id")
+  log.info("#{machine.location} is the machine id")
   volume_add_uri = discover_uri_for("add", "volumes")
   volume = post(volume_add_uri,
-  "<Volume>" +
+  "<VolumeCreate xmlns=\"#{CIMI::Test::CIMI_NAMESPACE}\">" +
     "<name>cimi_volume_for_attach</name>" +
     "<description>volume for attach testing</description>" +
     "<volumeTemplate>" +
       "<volumeConfig href=\"" + get_a(cep_json, "volumeConfig") + "\">" +
       "</volumeConfig>" +
     "</volumeTemplate>" +
-  "</Volume>",
+  "</VolumeCreate>",
   :accept => :json, :content_type => :xml)
 
-  log.info(volume.json["id"].to_s() + " is the volume id")
+  log.info(volume.location + " is the volume id")
   # 4.4: Attach the new Volume to a Machine
   model :machineWithVolume, :only => :xml do
-  attach_uri = discover_uri_for_subcollection("add", machine.json['id'], "volumes")
+  attach_uri = discover_uri_for_subcollection("add", machine.location, "volumes")
     post(attach_uri,
-    "<MachineVolume xmlns=\"http://schemas.dmtf.org/cimi/1/MachineVolume\">" +
+    "<MachineVolume xmlns=\"#{CIMI::Test::CIMI_NAMESPACE}\">" +
     "<initialLocation>/dev/sdf</initialLocation>" +
-    "<volume href=\"" + volume.json["id"] + "\"/>" +
+    "<volume href=\"" + volume.location + "\"/>" +
     "</MachineVolume>",
     :accept => :xml, :content_type => :xml)
   end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/af7a8684/tests/helpers/common.rb
----------------------------------------------------------------------
diff --git a/tests/helpers/common.rb b/tests/helpers/common.rb
index d592904..4324c70 100644
--- a/tests/helpers/common.rb
+++ b/tests/helpers/common.rb
@@ -30,6 +30,10 @@ module RestClient::Response
     end
   end
 
+  def location
+    headers[:location]
+  end
+
   def xml
     @xml ||= Nokogiri::XML(body)
   end


Mime
View raw message