diff --git a/server/Gemfile b/server/Gemfile index ad0d8e54c..631639165 100644 --- a/server/Gemfile +++ b/server/Gemfile @@ -39,7 +39,8 @@ group :test do gem 'rake' gem "rack-test", :require => 'rack/test' gem "minitest", '< 5.0.0' - gem "webmock", '< 1.10' # VCR wants that version + gem "webmock" + gem "excon", '>=0.9.6' gem "vcr" gem 'pry' gem 'nokogiri' diff --git a/server/lib/deltacloud/drivers/mock/mock_driver.rb b/server/lib/deltacloud/drivers/mock/mock_driver.rb index 0688ae638..5b76c479b 100644 --- a/server/lib/deltacloud/drivers/mock/mock_driver.rb +++ b/server/lib/deltacloud/drivers/mock/mock_driver.rb @@ -145,7 +145,8 @@ def create_image(credentials, opts={}) instance = instance(credentials, opts) safely do - raise 'CreateImageNotSupported' unless instance and instance.can_create_image? + raise 'NotFound' unless instance + raise 'CreateImageNotSupported' unless instance.can_create_image? image = { :id => opts[:name], :name => opts[:name], @@ -727,6 +728,10 @@ def update_bucket_size(id, change) message "Authentication Failure" end + on /CreateImageNotSupported/ do + status 500 + end + on /BucketNotEmpty/ do status 403 message "Delete operation not valid for non-empty bucket" @@ -745,14 +750,10 @@ def update_bucket_size(id, change) status 403 end - on /(BucketNotExist || NotFound)/ do + on /(BucketNotExist|NotFound)/ do status 404 end - on /CreateImageNotSupported/ do - status 500 - end - on /NotExistentBlob/ do status 500 message "Could not delete a non existent blob" diff --git a/server/tests/cimi/collections/machines_test.rb b/server/tests/cimi/collections/machines_test.rb index 9c411b1a8..790af2328 100644 --- a/server/tests/cimi/collections/machines_test.rb +++ b/server/tests/cimi/collections/machines_test.rb @@ -113,7 +113,7 @@ def ids(coll) (xml/'Collection/Machine').wont_be_empty (xml/'Collection/Machine').size.must_equal 3 xml.at('Collection/count').text.must_equal '3' - xml.at('Collection/Machine/name').text.must_equal 'Mock Instance With Profile Change' + xml.at('Collection/Machine/name').text.must_equal 'AnotherInstance' end end diff --git a/server/tests/drivers/mock/instances_test.rb b/server/tests/drivers/mock/instances_test.rb index 555019dc7..abe35f13e 100644 --- a/server/tests/drivers/mock/instances_test.rb +++ b/server/tests/drivers/mock/instances_test.rb @@ -25,7 +25,7 @@ @driver.instances(:id => 'inst1').must_be_kind_of Array @driver.instances(:id => 'inst1').size.must_equal 1 @driver.instances(:id => 'inst1').first.id.must_equal 'inst1' - @driver.instances(:owner_id => 'mockuser').size.must_equal 3 + @driver.instances(:owner_id => 'mockuser').size.must_equal 4 @driver.instances(:owner_id => 'mockuser').first.owner_id.must_equal 'mockuser' @driver.instances(:id => 'unknown').must_be_empty end