--- client/specs/fixtures/images/img1.yml | 1 + client/specs/fixtures/images/img2.yml | 1 + client/specs/fixtures/images/img3.yml | 1 + server/features/step_definitions/common_steps.rb | 4 +++- .../features/step_definitions/storage_volumes.rb | 14 -------------- server/features/storage_volumes.feature | 2 -- server/features/support/env.rb | 8 +++++++- server/lib/deltacloud/drivers/mock/mock_driver.rb | 1 + 8 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/client/specs/fixtures/images/img1.yml b/client/specs/fixtures/images/img1.yml index 9e56d25..98d8214 100644 --- a/client/specs/fixtures/images/img1.yml +++ b/client/specs/fixtures/images/img1.yml @@ -1,3 +1,4 @@ :description: Fedora 10 :owner_id: fedoraproject :architecture: x86_64 +:id: img1 diff --git a/client/specs/fixtures/images/img2.yml b/client/specs/fixtures/images/img2.yml index df8ffa6..4508446 100644 --- a/client/specs/fixtures/images/img2.yml +++ b/client/specs/fixtures/images/img2.yml @@ -1,3 +1,4 @@ :description: Fedora 10 :owner_id: fedoraproject :architecture: i386 +:id: img2 diff --git a/client/specs/fixtures/images/img3.yml b/client/specs/fixtures/images/img3.yml index a6b82a6..d9e33b0 100644 --- a/client/specs/fixtures/images/img3.yml +++ b/client/specs/fixtures/images/img3.yml @@ -1,3 +1,4 @@ :description: JBoss :owner_id: mockuser :architecture: i386 +:id: img3 diff --git a/server/features/step_definitions/common_steps.rb b/server/features/step_definitions/common_steps.rb index f657a61..4b5fc17 100644 --- a/server/features/step_definitions/common_steps.rb +++ b/server/features/step_definitions/common_steps.rb @@ -85,7 +85,9 @@ end
Then /^(.+) should include (.+) parameter$/ do |model, parameter| Nokogiri::XML(last_response.body).xpath("/#{model.tr(' ', '-')}/#{parameter}").first.should_not == nil - Nokogiri::XML(last_response.body).xpath("/#{model.tr(' ', '-')}/#{parameter}").first.text.should_not == '' + unless ['device'].include?(parameter) + Nokogiri::XML(last_response.body).xpath("/#{model.tr(' ', '-')}/#{parameter}").text.should_not == "" + end end
Given /^I am authorized to (list) (.+)$/ do |operation, collection| diff --git a/server/features/step_definitions/storage_volumes.rb b/server/features/step_definitions/storage_volumes.rb index fcd0fb3..23546b0 100644 --- a/server/features/step_definitions/storage_volumes.rb +++ b/server/features/step_definitions/storage_volumes.rb @@ -2,17 +2,3 @@ Then /^storage volume should have valid href parameter$/ do href=Nokogiri::XML(last_response.body).xpath('/storage-volume').first[:href] href.should == "http://example.org/api/storage_volumes/#%7BCONFIG%5B:storage_volume_id%5D%7D" end - -Then /^I could follow instance href attribute$/ do - instance = Nokogiri::XML(last_response.body).xpath('/storage-volume/instance').first - instance.should_not == nil - instance_url = URI.parse(instance[:href]).path - instance_url.should_not == '' - get instance_url, {} - last_response.body.strip.should_not == '' -end - -Then /^this attribute should point me to valid instance$/ do - Nokogiri::XML(last_response.body).root.name.should == 'instance' - Nokogiri::XML(last_response.body).xpath('/instance/id').first.text.should == CONFIG[:storage_volume_instance] -end diff --git a/server/features/storage_volumes.feature b/server/features/storage_volumes.feature index a370d1e..32e289f 100644 --- a/server/features/storage_volumes.feature +++ b/server/features/storage_volumes.feature @@ -25,8 +25,6 @@ Feature: Working with storage volumes Given I am authorized to show storage volume '<STORAGE_VOLUME_ID>' When I request for '<STORAGE_VOLUME_ID>' storage volume Then I should get this storage volume - And I could follow instance href attribute - And this attribute should point me to valid instance
Scenario: I want filter storage volumes by state Given I am authorized to list storage volumes diff --git a/server/features/support/env.rb b/server/features/support/env.rb index f92fcc2..95d47cc 100644 --- a/server/features/support/env.rb +++ b/server/features/support/env.rb @@ -13,15 +13,21 @@ CONFIG = YAML::load_file(File::join('features', 'support', ENV['API_DRIVER'], 'c World do def app @app = Rack::Builder.new do + set :logging, true run Sinatra::Application end - end + end
def replace_variables(str) CONFIG.keys.collect { |k| str.gsub!(/<#{k.to_s.upcase}>/, "#{CONFIG[k]}") } return str end
+ Before do + header 'Accept', 'application/xml' + end + include Rack::Test::Methods + end
diff --git a/server/lib/deltacloud/drivers/mock/mock_driver.rb b/server/lib/deltacloud/drivers/mock/mock_driver.rb index c3e2b84..832609e 100644 --- a/server/lib/deltacloud/drivers/mock/mock_driver.rb +++ b/server/lib/deltacloud/drivers/mock/mock_driver.rb @@ -130,6 +130,7 @@ class MockDriver < Deltacloud::BaseDriver Dir[ "#{@storage_root}/images/*.yml" ].each do |image_file| image = YAML.load( File.read( image_file ) ) image[:id] = File.basename( image_file, ".yml" ) + image[:name] = image[:description] images << Image.new( image ) end images = filter_on( images, :id, opts )