Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes to make basic unit tests pass #50

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion server/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
13 changes: 7 additions & 6 deletions server/lib/deltacloud/drivers/mock/mock_driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion server/tests/cimi/collections/machines_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion server/tests/drivers/mock/instances_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down