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/volume/list_volumes.rb
Philip Mark M. Deazeta 609995ccbe [openstack] Fixed mocks for failing shindo tests
reverted back to double quoted string

Conflicts:
	lib/fog/openstack/identity.rb
	lib/fog/openstack/requests/compute/get_volume_details.rb
	lib/fog/openstack/requests/compute/list_security_groups.rb
	lib/fog/openstack/requests/identity/list_tenants.rb
	lib/fog/openstack/requests/image/create_image.rb
	lib/fog/openstack/requests/image/list_public_images.rb
	lib/fog/openstack/requests/image/list_public_images_detailed.rb
	lib/fog/openstack/requests/image/update_image.rb
	tests/openstack/requests/compute/volume_tests.rb
2012-09-28 15:07:38 +08:00

55 lines
1.4 KiB
Ruby

module Fog
module Volume
class OpenStack
class Real
def list_volumes(detailed=true)
path = detailed ? 'volumes/detail' : '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" => "test 1 desc",
"availability_zone" => "nova",
"display_name" => "Volume1",
"attachments" => [{}],
"volume_type" => nil,
"snapshot_id" => nil,
"size" => 1,
"id" => 1,
"created_at" => Time.now,
"metadata" => {} },
{ "status" => "available",
"display_description" => "test 2 desc",
"availability_zone" => "nova",
"display_name" => "Volume2",
"attachments" => [{}],
"volume_type" => nil,
"snapshot_id" => nil,
"size" => 1,
"id" => 2,
"created_at" => Time.now,
"metadata" => {} }
]
response.body = { 'volumes' => self.data[:volumes] }
response
end
end
end
end
end