2011-06-16 19:28:54 -04:00
|
|
|
Shindo.tests('Fog::Compute[:brightbox] | image requests', ['brightbox']) do
|
2010-12-06 09:50:59 -05:00
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
|
|
|
|
## Difficult to test without having uploaded an Image to your account to register
|
|
|
|
# creation_options = {
|
|
|
|
# "arch" => "i686",
|
|
|
|
# "source" => "fnord"
|
|
|
|
# }
|
2011-09-29 05:15:03 -04:00
|
|
|
# tests("#create_image(#{creation_options.inspect})")
|
|
|
|
# result = Fog::Compute[:brightbox].create_image(creation_options)
|
|
|
|
# @image_id = result["id"]
|
|
|
|
# formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
# end
|
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
# Fog::Compute[:brightbox].images.get(@image_id).wait_for { ready? }
|
2010-12-06 09:50:59 -05:00
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#list_images") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].list_images
|
|
|
|
@image_id = result.first["id"]
|
|
|
|
formats(Brightbox::Compute::Formats::Collection::IMAGES) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#get_image('#{@image_id}')") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].get_image(@image_id)
|
|
|
|
formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
## Until Image creation can be automated, we shouldn't be updating Images randomly
|
|
|
|
# update_options = {}
|
2011-09-29 05:15:03 -04:00
|
|
|
# tests("#update_image('#{@image_id}', #{update_options.inspect})") do
|
|
|
|
# result = Fog::Compute[:brightbox].update_image(@image_id, :name => "New name from Fog test")
|
|
|
|
# formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
# end
|
|
|
|
|
|
|
|
## Same as other tests - can't be deleting them unless part of the test run
|
2011-09-29 05:15:03 -04:00
|
|
|
# tests("#destroy_server('#{@image_id}')") do
|
|
|
|
# result = Fog::Compute[:brightbox].destroy_image(@image_id)
|
|
|
|
# formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
# end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
|
|
|
|
|
|
|
tests("#get_image('img-00000')").raises(Excon::Errors::NotFound) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:brightbox].get_image('img-00000')
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2010-12-17 19:49:22 -05:00
|
|
|
tests("#get_image").raises(ArgumentError) do
|
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:brightbox].get_image
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
2010-12-17 19:49:22 -05:00
|
|
|
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|