1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/openstack/requests/compute/list_volumes.rb
Nelvin Driz 0035231954 [openstack] Fix Failing Shindo Tests
Signed-off-by: Nelvin Driz <nelvindriz@live.com>
2012-10-02 14:09:02 +08:00

51 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" => Fog::Mock.random_hex(32),
"created_at" => Time.now },
{ "status" => "available",
"display_description" => "",
"availability_zone" => "nova",
"display_name" => "test 2",
"attachments" => [{}],
"volume_type" => nil,
"snapshot_id" => nil,
"size" => 1,
"id" => Fog::Mock.random_hex(32),
"created_at" => Time.now }
]
response.body = { 'volumes' => self.data[:volumes] }
response
end
end
end
end
end