diff --git a/lib/fog/rackspace/requests/block_storage/get_volume_type.rb b/lib/fog/rackspace/requests/block_storage/get_volume_type.rb index 8d3fd7a76..89e12608b 100644 --- a/lib/fog/rackspace/requests/block_storage/get_volume_type.rb +++ b/lib/fog/rackspace/requests/block_storage/get_volume_type.rb @@ -6,7 +6,7 @@ module Fog request( :expects => [200], :method => 'GET', - :path => "/types/#{volume_type_id}" + :path => "types/#{volume_type_id}" ) end end diff --git a/lib/fog/rackspace/requests/block_storage/list_volume_types.rb b/lib/fog/rackspace/requests/block_storage/list_volume_types.rb index db10a14ef..ea033c279 100644 --- a/lib/fog/rackspace/requests/block_storage/list_volume_types.rb +++ b/lib/fog/rackspace/requests/block_storage/list_volume_types.rb @@ -6,7 +6,7 @@ module Fog request( :expects => [200], :method => 'GET', - :path => '/types' + :path => 'types' ) end end diff --git a/tests/rackspace/models/block_storage/volume_types_tests.rb b/tests/rackspace/models/block_storage/volume_types_tests.rb new file mode 100644 index 000000000..241dd8fb4 --- /dev/null +++ b/tests/rackspace/models/block_storage/volume_types_tests.rb @@ -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 diff --git a/tests/rackspace/requests/block_storage/volume_type_tests.rb b/tests/rackspace/requests/block_storage/volume_type_tests.rb new file mode 100644 index 000000000..84fb163e6 --- /dev/null +++ b/tests/rackspace/requests/block_storage/volume_type_tests.rb @@ -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