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

[rackspace|blockstorage] Add volume type tests.

This commit is contained in:
Brad Gignac 2012-09-04 20:19:00 -04:00
parent 82034ce6b1
commit 4206fcfae2
4 changed files with 53 additions and 2 deletions

View file

@ -6,7 +6,7 @@ module Fog
request(
:expects => [200],
:method => 'GET',
:path => "/types/#{volume_type_id}"
:path => "types/#{volume_type_id}"
)
end
end

View file

@ -6,7 +6,7 @@ module Fog
request(
:expects => [200],
:method => 'GET',
:path => '/types'
:path => 'types'
)
end
end

View file

@ -0,0 +1,20 @@
Shindo.tests('Fog::Rackspace::BlockStorage | volume_types', ['rackspace']) do
pending if Fog.mocking?
service = Fog::Rackspace::BlockStorage.new
tests("success") do
tests("#all").succeeds do
service.volume_types.all
end
tests("#get").succeeds do
service.volume_types.get(1)
end
end
tests("failure").returns(nil) do
service.volume_types.get('some_random_identity')
end
end

View file

@ -0,0 +1,31 @@
Shindo.tests('Fog::Rackspace::BlockStorage | volume_type_tests', ['rackspace']) do
pending if Fog.mocking?
VOLUME_TYPE_FORMAT = {
'name' => String,
'extra_specs' => Hash
}
LIST_VOLUME_TYPE_FORMAT = {
'volume_types' => [VOLUME_TYPE_FORMAT.merge({ 'id' => Integer })]
}
GET_VOLUME_TYPE_FORMAT = {
'volume_type' => VOLUME_TYPE_FORMAT.merge({ 'id' => String })
}
service = Fog::Rackspace::BlockStorage.new
tests('success') do
volume_type_id = 1
tests("#list_volume_types").formats(LIST_VOLUME_TYPE_FORMAT) do
service.list_volume_types.body
end
tests("#get_volume_type(#{volume_type_id})").formats(GET_VOLUME_TYPE_FORMAT) do
service.get_volume_type(volume_type_id).body
end
end
end