1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[openstack|compute] update volume tests

This commit is contained in:
Brian D. Burns 2013-08-13 04:57:36 +00:00
parent 0dc399f3a8
commit 587dcbe609
2 changed files with 18 additions and 19 deletions

View file

@ -33,15 +33,16 @@ module Fog
response.status = 202
data = {
'id' => Fog::Mock.random_numbers(2),
'name' => name,
'description' => description,
'displayName' => name,
'displayDescription' => description,
'size' => size,
'status' => 'creating',
'snapshot_id' => '4',
'volume_type' => nil,
'availability_zone' => 'nova',
'created_at' => Time.now,
'attachments' => []
'snapshotId' => nil,
'volumeType' => 'None',
'availabilityZone' => 'nova',
'createdAt' => Time.now.strftime('%FT%T.%6N'),
'attachments' => [],
'metadata' => {}
}
self.data[:volumes][data['id']] = data
response.body = { 'volume' => data }

View file

@ -4,35 +4,33 @@ Shindo.tests('Fog::Compute[:openstack] | volume requests', ['openstack']) do
@volume_format = {
'id' => String,
'name' => String,
'displayName' => String,
'size' => Integer,
'description' => String,
'displayDescription' => String,
'status' => String,
'snapshot_id' => Fog::Nullable::String,
'availability_zone' => String,
'snapshotId' => Fog::Nullable::String,
'availabilityZone' => String,
'attachments' => Array,
'volume_type' => Fog::Nullable::String,
'created_at' => Time
'volumeType' => Fog::Nullable::String,
'createdAt' => String,
'metadata' => Hash
}
tests('success') do
tests('#create_volume').formats({'volume' => @volume_format}) do
pending unless Fog.mocking?
tests('#create_volume').data_matches_schema({'volume' => @volume_format}) do
Fog::Compute[:openstack].create_volume('loud', 'this is a loud volume', 3).body
end
tests('#list_volumes').formats({'volumes' => [@volume_format]}) do
tests('#list_volumes').data_matches_schema({'volumes' => [@volume_format]}) do
Fog::Compute[:openstack].list_volumes.body
end
tests('#get_volume_detail').formats({'volume' => @volume_format}) do
pending unless Fog.mocking?
tests('#get_volume_detail').data_matches_schema({'volume' => @volume_format}) do
volume_id = Fog::Compute[:openstack].volumes.all.first.id
Fog::Compute[:openstack].get_volume_details(volume_id).body
end
tests('#delete_volume').succeeds do
pending unless Fog.mocking?
volume_id = Fog::Compute[:openstack].volumes.all.first.id
Fog::Compute[:openstack].delete_volume(volume_id)
end