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/identity/list_roles.rb
Nelvin Driz 92aed2a18d [openstack|identity] Update Fog Mocks on Authentication, User and Roles
Signed-off-by: Nelvin Driz <nelvindriz@live.com>

Conflicts:
	lib/fog/openstack/identity.rb
	lib/fog/openstack/requests/identity/delete_role.rb
	lib/fog/openstack/requests/identity/list_roles.rb
2012-09-28 15:17:57 +08:00

36 lines
689 B
Ruby

module Fog
module Identity
class OpenStack
class Real
def list_roles
request(
:expects => 200,
:method => 'GET',
:path => '/OS-KSADM/roles'
)
end
end
class Mock
def list_roles
if self.data[:roles].empty?
['admin', 'Member'].each do |name|
id = Fog::Mock.random_hex(32)
self.data[:roles][id] = {'id' => id, 'name' => name}
end
end
Excon::Response.new(
:body => { 'roles' => self.data[:roles].values },
:status => 200
)
end
end
end
end
end