2011-09-29 14:10:21 -04:00
|
|
|
require 'fog/openstack'
|
|
|
|
|
2011-09-26 02:41:54 -04:00
|
|
|
Shindo.tests('Fog::Compute[:openstack] | image requests', ['openstack']) do
|
|
|
|
|
|
|
|
@image_format = {
|
|
|
|
'created' => Fog::Nullable::String,
|
|
|
|
'id' => String,
|
|
|
|
'name' => String,
|
|
|
|
'progress' => Fog::Nullable::Integer,
|
|
|
|
'status' => String,
|
|
|
|
'updated' => String,
|
2011-09-29 14:10:21 -04:00
|
|
|
'minRam' => Integer,
|
|
|
|
'minDisk' => Integer,
|
|
|
|
'server' => Fog::Nullable::Hash,
|
2011-09-26 02:41:54 -04:00
|
|
|
'metadata' => Hash,
|
|
|
|
'links' => Array
|
|
|
|
}
|
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
|
2011-09-29 14:10:21 -04:00
|
|
|
@image_id = Fog::Compute[:openstack].images[0].id
|
2011-09-26 02:41:54 -04:00
|
|
|
|
|
|
|
unless Fog.mocking?
|
|
|
|
Fog::Compute[:openstack].images.get(@image_id).wait_for { ready? }
|
|
|
|
end
|
|
|
|
tests("#get_image_details(#{@image_id})").formats(@image_format) do
|
|
|
|
pending if Fog.mocking?
|
|
|
|
Fog::Compute[:openstack].get_image_details(@image_id).body['image']
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('#list_images').formats({'images' => [OpenStack::Compute::Formats::SUMMARY]}) do
|
|
|
|
Fog::Compute[:openstack].list_images.body
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('#list_images_detail').formats({'images' => [@image_format]}) do
|
|
|
|
Fog::Compute[:openstack].list_images_detail.body
|
|
|
|
end
|
|
|
|
|
|
|
|
unless Fog.mocking?
|
|
|
|
Fog::Compute[:openstack].images.get(@image_id).wait_for { ready? }
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
|
|
|
|
2011-09-29 14:10:21 -04:00
|
|
|
tests('#delete_image(0)').raises(Fog::Compute::OpenStack::NotFound) do
|
|
|
|
pending if Fog.mocking?
|
2011-09-26 02:41:54 -04:00
|
|
|
Fog::Compute[:openstack].delete_image(0)
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('#get_image_details(0)').raises(Fog::Compute::OpenStack::NotFound) do
|
|
|
|
pending if Fog.mocking?
|
|
|
|
Fog::Compute[:openstack].get_image_details(0)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|