You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2011/05/13 10:51:34 UTC
svn commit: r1102614 - in /incubator/deltacloud/trunk/tests:
ec2/hardware_profiles.feature ec2/images.feature ec2/instances.feature
ec2/step_definitions/api_steps.rb mock/hardware_profiles.feature
mock/instances.feature mock/step_definitions/api_steps.rb
Author: mfojtik
Date: Fri May 13 08:51:34 2011
New Revision: 1102614
URL: http://svn.apache.org/viewvc?rev=1102614&view=rev
Log:
bug fixes in mock/ec2 cucumber tests
Modified:
incubator/deltacloud/trunk/tests/ec2/hardware_profiles.feature
incubator/deltacloud/trunk/tests/ec2/images.feature
incubator/deltacloud/trunk/tests/ec2/instances.feature
incubator/deltacloud/trunk/tests/ec2/step_definitions/api_steps.rb
incubator/deltacloud/trunk/tests/mock/hardware_profiles.feature
incubator/deltacloud/trunk/tests/mock/instances.feature
incubator/deltacloud/trunk/tests/mock/step_definitions/api_steps.rb
Modified: incubator/deltacloud/trunk/tests/ec2/hardware_profiles.feature
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/hardware_profiles.feature?rev=1102614&r1=1102613&r2=1102614&view=diff
==============================================================================
--- incubator/deltacloud/trunk/tests/ec2/hardware_profiles.feature (original)
+++ incubator/deltacloud/trunk/tests/ec2/hardware_profiles.feature Fri May 13 08:51:34 2011
@@ -26,4 +26,4 @@ Feature: Accessing hardware profiles
When client access this URI with parameters:
| architecture | i386 |
Then client should get some hardware_profiles
- And each hardware_profile should have 'architecture' attribute set to 'i386'
+ And each hardware_profile should have 'architecture' property set to 'i386'
Modified: incubator/deltacloud/trunk/tests/ec2/images.feature
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/images.feature?rev=1102614&r1=1102613&r2=1102614&view=diff
==============================================================================
--- incubator/deltacloud/trunk/tests/ec2/images.feature (original)
+++ incubator/deltacloud/trunk/tests/ec2/images.feature Fri May 13 08:51:34 2011
@@ -40,7 +40,7 @@ Feature: Listing and showing images
When client access this URI with parameters:
| owner_id | 205605819716 |
Then client should get some images
- And each image should have 'owner_id' attribute set to '205605819716'
+ And each image should have 'owner_id' element set to '205605819716'
Scenario: Filtering images by architecture
Given URI /api/images exists
@@ -48,7 +48,7 @@ Feature: Listing and showing images
When client access this URI with parameters:
| architecture | i386 |
Then client should get some images
- And each image should have 'architecture' attribute set to 'i386'
+ And each image should have 'architecture' element set to 'i386'
Scenario: Filtering images by architecture and owner_id
Given URI /api/images exists
@@ -57,5 +57,5 @@ Feature: Listing and showing images
| architecture | i386 |
| owner_id | 205605819716 |
Then client should get some images
- And each image should have 'architecture' attribute set to 'i386'
- And each image should have 'owner_id' attribute set to '205605819716'
+ And each image should have 'architecture' element set to 'i386'
+ And each image should have 'owner_id' element set to '205605819716'
Modified: incubator/deltacloud/trunk/tests/ec2/instances.feature
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/instances.feature?rev=1102614&r1=1102613&r2=1102614&view=diff
==============================================================================
--- incubator/deltacloud/trunk/tests/ec2/instances.feature (original)
+++ incubator/deltacloud/trunk/tests/ec2/instances.feature Fri May 13 08:51:34 2011
@@ -68,7 +68,7 @@ Feature: Managing instances
When client access this URI with parameters:
| state | STOPPED |
Then client should get some instances
- And each instance should have 'state' attribute set to 'RUNNING'
+ And each instance should have 'state' element set to 'RUNNING'
Scenario: Get details about first instance
Given URI /api/instances exists
Modified: incubator/deltacloud/trunk/tests/ec2/step_definitions/api_steps.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/step_definitions/api_steps.rb?rev=1102614&r1=1102613&r2=1102614&view=diff
==============================================================================
--- incubator/deltacloud/trunk/tests/ec2/step_definitions/api_steps.rb (original)
+++ incubator/deltacloud/trunk/tests/ec2/step_definitions/api_steps.rb Fri May 13 08:51:34 2011
@@ -79,6 +79,12 @@ Then /^each (\w+) should have '(.+)' att
path = '/api/link'
when 'image':
path = '/images/image'
+ when 'instance':
+ path = '/instances/instance'
+ when 'key':
+ path = '/keys/key'
+ when 'realm':
+ path = '/realms/realm'
end
output_xml.xpath(path).each do |entry_point|
@entry_points.include?(entry_point[attr]).should == true if t=='name'
@@ -92,13 +98,44 @@ end
Then /^each ([\w\-]+) should have '(.+)' attribute set to '(.+)'$/ do |el, attr, v|
case el
when 'image':
- path = "/image/images"
+ path = "/images/image"
+ when 'hardware_profile':
+ path = "/hardware_profiles/hardware_profile"
+ when 'instance':
+ path = "/instances/instance"
end
output_xml.xpath(path).each do |element|
element[attr].should == v
end
end
+Then /^each ([\w\-]+) should have '(.+)' element set to '(.+)'$/ do |el, child, v|
+ case el
+ when 'image':
+ path = "/images/image"
+ when 'hardware_profile':
+ path = "/hardware_profiles/hardware_profile"
+ when 'instance':
+ path = "/instances/instance"
+ end
+ output_xml.xpath(path).each do |element|
+ element.xpath(child).should_not be_nil
+ element.xpath(child).first.content.should == v
+ end
+end
+
+Then /^each ([\w\-]+) should have '(.+)' property set to '(.+)'$/ do |el, property, v|
+ case el
+ when 'hardware_profile':
+ path = "/hardware_profiles/hardware_profile"
+ end
+ output_xml.xpath(path).each do |element|
+ property_elm=element.xpath("property[@name=\"#{property}\"]")
+ property_elm.should_not be_nil
+ property_elm.first["value"].should == v
+ end
+end
+
When /^client follow this attribute$/ do
output_xml.xpath('/api/link').each do |entry_point|
get entry_point[@last_attribute], {}
Modified: incubator/deltacloud/trunk/tests/mock/hardware_profiles.feature
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/mock/hardware_profiles.feature?rev=1102614&r1=1102613&r2=1102614&view=diff
==============================================================================
--- incubator/deltacloud/trunk/tests/mock/hardware_profiles.feature (original)
+++ incubator/deltacloud/trunk/tests/mock/hardware_profiles.feature Fri May 13 08:51:34 2011
@@ -26,4 +26,4 @@ Feature: Accessing hardware profiles
When client access this URI with parameters:
| architecture | i386 |
Then client should get some hardware_profiles
- And each hardware_profile should have 'architecture' attribute set to 'i386'
+ And each hardware_profile should have 'architecture' property set to 'i386'
Modified: incubator/deltacloud/trunk/tests/mock/instances.feature
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/mock/instances.feature?rev=1102614&r1=1102613&r2=1102614&view=diff
==============================================================================
--- incubator/deltacloud/trunk/tests/mock/instances.feature (original)
+++ incubator/deltacloud/trunk/tests/mock/instances.feature Fri May 13 08:51:34 2011
@@ -25,7 +25,7 @@ Feature: Managing instances
When client access this URI with parameters:
| state | RUNNING |
Then client should get some instances
- And each instance should have 'state' attribute set to 'RUNNING'
+ And each instance should have 'state' element set to 'RUNNING'
Scenario: Get details about first instance
Given URI /api/instances exists
Modified: incubator/deltacloud/trunk/tests/mock/step_definitions/api_steps.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/mock/step_definitions/api_steps.rb?rev=1102614&r1=1102613&r2=1102614&view=diff
==============================================================================
--- incubator/deltacloud/trunk/tests/mock/step_definitions/api_steps.rb (original)
+++ incubator/deltacloud/trunk/tests/mock/step_definitions/api_steps.rb Fri May 13 08:51:34 2011
@@ -72,6 +72,12 @@ Then /^each (\w+) should have '(.+)' att
path = '/api/link'
when 'image':
path = '/images/image'
+ when 'instance':
+ path = '/instances/instance'
+ when 'key':
+ path = '/keys/key'
+ when 'realm':
+ path = '/realms/realm'
end
output_xml.xpath(path).each do |entry_point|
@entry_points.include?(entry_point[attr]).should == true if t=='name'
@@ -86,12 +92,43 @@ Then /^each ([\w\-]+) should have '(.+)'
case el
when 'image':
path = "/image/images"
+ when 'hardware_profile':
+ path = "/hardware_profiles/hardware_profile"
+ when 'instance':
+ path = "/instances/instance"
end
output_xml.xpath(path).each do |element|
element[attr].should == v
end
end
+Then /^each ([\w\-]+) should have '(.+)' element set to '(.+)'$/ do |el, child, v|
+ case el
+ when 'image':
+ path = "/images/image"
+ when 'hardware_profile':
+ path = "/hardware_profiles/hardware_profile"
+ when 'instance':
+ path = "/instances/instance"
+ end
+ output_xml.xpath(path).each do |element|
+ element.xpath(child).should_not be_nil
+ element.xpath(child).first.content.should == v
+ end
+end
+
+Then /^each ([\w\-]+) should have '(.+)' property set to '(.+)'$/ do |el, property, v|
+ case el
+ when 'hardware_profile':
+ path = "/hardware_profiles/hardware_profile"
+ end
+ output_xml.xpath(path).each do |element|
+ property_elm=element.xpath("property[@name=\"#{property}\"]")
+ property_elm.should_not be_nil
+ property_elm.first["value"].should == v
+ end
+end
+
When /^client follow this attribute$/ do
output_xml.xpath('/api/link').each do |entry_point|
get entry_point[@last_attribute], {}