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

snakecase Change in snaphot_id Added mcks for volume attach and detach Conflicts: lib/fog/openstack/requests/compute/create_volume.rb lib/fog/openstack/requests/compute/get_volume_details.rb lib/fog/openstack/requests/compute/list_volumes.rb
53 lines
1.4 KiB
Ruby
53 lines
1.4 KiB
Ruby
module Fog
|
|
module Compute
|
|
class OpenStack
|
|
class Real
|
|
|
|
def list_volumes(detailed=true)
|
|
path = detailed ? 'os-volumes/detail' : 'os-volumes'
|
|
request(
|
|
:expects => 200,
|
|
:method => 'GET',
|
|
:path => path
|
|
)
|
|
end
|
|
|
|
end
|
|
|
|
class Mock
|
|
|
|
def list_volumes(detailed=true)
|
|
response = Excon::Response.new
|
|
response.status = 200
|
|
self.data[:volumes] ||= [
|
|
{ "status" => "available",
|
|
"display_description" => "",
|
|
"availability_zone" => "nova",
|
|
"display_name" => "test 1",
|
|
"attachments" => [{}],
|
|
"volume_type" => nil,
|
|
"snapshot_id" => nil,
|
|
"size" => 1,
|
|
"id" => 6,
|
|
"created_at" => "2012-03-30 05:31:00.655058",
|
|
"metadata" => {} },
|
|
{ "status" => "available",
|
|
"display_description" => "",
|
|
"availability_zone" => "nova",
|
|
"display_name" => "test 2",
|
|
"attachments" => [{}],
|
|
"volume_type" => nil,
|
|
"snapshot_id" => nil,
|
|
"size" => 1,
|
|
"id" => 8,
|
|
"created_at" => "2012-03-30 16:14:55.582717",
|
|
"metadata" => {} }
|
|
]
|
|
response.body = { 'volumes' => self.data[:volumes] }
|
|
response
|
|
end
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|