deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1234732 - in /deltacloud/trunk/server: spec/spec_helper.rb tests/cimi/features/step_definitions/common_steps.rb tests/cimi/features/step_definitions/machines_steps.rb tests/cimi/features/support/env.rb
Date Mon, 23 Jan 2012 10:27:32 GMT
Author: mfojtik
Date: Mon Jan 23 10:27:31 2012
New Revision: 1234732

URL: http://svn.apache.org/viewvc?rev=1234732&view=rev
Log:
CIMI: Fixed Cucumber tests to reflect latest changes

Modified:
    deltacloud/trunk/server/spec/spec_helper.rb
    deltacloud/trunk/server/tests/cimi/features/step_definitions/common_steps.rb
    deltacloud/trunk/server/tests/cimi/features/step_definitions/machines_steps.rb
    deltacloud/trunk/server/tests/cimi/features/support/env.rb

Modified: deltacloud/trunk/server/spec/spec_helper.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/spec/spec_helper.rb?rev=1234732&r1=1234731&r2=1234732&view=diff
==============================================================================
--- deltacloud/trunk/server/spec/spec_helper.rb (original)
+++ deltacloud/trunk/server/spec/spec_helper.rb Mon Jan 23 10:27:31 2012
@@ -16,7 +16,7 @@
 
 require 'rubygems'
 require 'pp'
-require 'rspec'
+require 'rspec/core'
 require 'deltacloud/core_ext'
 require 'cimi/model'
 require 'xmlsimple'

Modified: deltacloud/trunk/server/tests/cimi/features/step_definitions/common_steps.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/tests/cimi/features/step_definitions/common_steps.rb?rev=1234732&r1=1234731&r2=1234732&view=diff
==============================================================================
--- deltacloud/trunk/server/tests/cimi/features/step_definitions/common_steps.rb (original)
+++ deltacloud/trunk/server/tests/cimi/features/step_definitions/common_steps.rb Mon Jan 23
10:27:31 2012
@@ -17,18 +17,17 @@ When /^client lists ([\w ]+) collection$
   header 'Accept', 'application/xml'
   get "/cimi/%s" % col_name.to_collection_uri
   last_response.status.should == 200
-  puts last_response.body
 end
 
 Then /^client should get list of all ([\w ]+)$/ do |col_name|
-  root_name = "#{col_name.to_class_name}Collection"
+  root_name = "#{col_name.to_collection_name}Collection"
   last_xml_response.root.name.should == root_name
   (last_xml_response/"#{root_name}/name").size.should == 1
   (last_xml_response/"#{root_name}/name").first.text.should == 'default'
   (last_xml_response/"#{root_name}/uri").size.should == 1
   (last_xml_response/"#{root_name}/uri").first.text.should == last_request.url
-  (last_xml_response/"#{root_name}/#{col_name.to_class_name}").size.should == 3
-  (last_xml_response/"#{root_name}/#{col_name.to_class_name}").each do |machine_img|
+  (last_xml_response/"#{root_name}/#{col_name.to_entity_name}").size.should == 3
+  (last_xml_response/"#{root_name}/#{col_name.to_entity_name}").each do |machine_img|
     machine_img[:href].should_not be_nil
     machine_img[:href].should =~ /http:\/\/example\.org\/cimi\/#{col_name.to_collection_uri}\/img(\d)/
   end
@@ -39,7 +38,6 @@ When /^client( should be able to)? query
   header 'Accept', 'application/xml'
   get "/cimi/%s/%s" % [entity_name.to_entity_uri, entity_id]
   last_response.status.should == 200
-  puts last_response.body
   @entity_id = entity_id
 end
 
@@ -50,7 +48,7 @@ Then /^client should verify that this ([
 end
 
 Then /^client should verify that this ([\w ]+) has set$/ do |entity, attrs|
-  model = CIMI::Model.const_get(entity.to_entity_name).from_xml(last_response.body)
+  model = CIMI::Model.const_get(entity.to_class_name).from_xml(last_response.body)
   attrs.rows_hash.each do |key, value|
     if key =~ /^\*/
       model.send(key.gsub(/^\*/, '').intern).href.should == value

Modified: deltacloud/trunk/server/tests/cimi/features/step_definitions/machines_steps.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/tests/cimi/features/step_definitions/machines_steps.rb?rev=1234732&r1=1234731&r2=1234732&view=diff
==============================================================================
--- deltacloud/trunk/server/tests/cimi/features/step_definitions/machines_steps.rb (original)
+++ deltacloud/trunk/server/tests/cimi/features/step_definitions/machines_steps.rb Mon Jan
23 10:27:31 2012
@@ -23,12 +23,12 @@ When /^client specifies a new Machine us
   @machine_configuration.should_not be_nil
   @new_machine_name = machine.raw[0][1]
   @builder = Nokogiri::XML::Builder.new do |xml|
-    xml.Machine(:xmlns => CMWG_NAMESPACE) {
+    xml.MachineCreate(:xmlns => CMWG_NAMESPACE) {
       xml.name @new_machine_name
       xml.description machine.raw[1][1]
-      xml.MachineTemplate {
-        xml.MachineConfig( :href => @machine_configuration.uri )
-        xml.MachineImage( :href => @machine_image.uri )
+      xml.machineTemplate {
+        xml.machineConfig( :href => @machine_configuration.uri )
+        xml.machineImage( :href => @machine_image.uri )
       }
     }
   end
@@ -38,6 +38,9 @@ Then /^client should be able to create t
   authorize 'mockuser', 'mockpassword'
   header 'Content-Type', 'application/xml'
   post '/cimi/machines', @builder.to_xml
+  if [500, 501, 502].include? last_response.status
+    puts last_response.body
+  end
   last_response.status.should == 201
   set_new_machine(CIMI::Model::Machine.from_xml(last_response.body))
 end
@@ -46,6 +49,9 @@ Then /^client query for created Machine 
   authorize 'mockuser', 'mockpassword'
   header 'Content-Type', 'application/xml'
   get "/cimi/machines/%s" % new_machine.name
+  if [500, 501, 502].include? last_response.status
+    puts last_response.body
+  end
   if @delete_operation
     last_response.status.should == 404
   else
@@ -75,7 +81,7 @@ When /^client executes (\w+) operation o
   authorize 'mockuser', 'mockpassword'
   header 'Content-Type', 'application/xml'
   if operation == 'delete'
-    delete "/cimi/machines/%s/delete" % new_machine.name
+    delete "/cimi/machines/%s" % new_machine.name
     last_response.status.should == 200
     last_response.body.should be_empty
     @delete_operation = true

Modified: deltacloud/trunk/server/tests/cimi/features/support/env.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/tests/cimi/features/support/env.rb?rev=1234732&r1=1234731&r2=1234732&view=diff
==============================================================================
--- deltacloud/trunk/server/tests/cimi/features/support/env.rb (original)
+++ deltacloud/trunk/server/tests/cimi/features/support/env.rb Mon Jan 23 10:27:31 2012
@@ -27,11 +27,15 @@ end
 class String
 
   def to_class_name
-    to_entity_name.singularize
+    to_collection_name
   end
 
   def to_entity_name
-    self.tr(' ', '')
+    to_collection_name.uncapitalize
+  end
+
+  def to_collection_name
+    self.tr(' ', '').singularize
   end
 
   def to_collection_uri



Mime
View raw message