2012-02-22 09:40:32 -05:00
|
|
|
module Fog
|
|
|
|
module Identity
|
|
|
|
class OpenStack
|
|
|
|
class Real
|
2012-04-02 03:26:45 -04:00
|
|
|
def list_users(tenant_id = nil)
|
|
|
|
path = tenant_id ? "tenants/#{tenant_id}/users" : 'users'
|
2012-02-22 09:40:32 -05:00
|
|
|
request(
|
|
|
|
:expects => [200, 204],
|
|
|
|
:method => 'GET',
|
2012-04-02 03:26:45 -04:00
|
|
|
:path => path
|
2012-02-22 09:40:32 -05:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end # class Real
|
|
|
|
|
|
|
|
class Mock
|
2012-04-02 03:26:45 -04:00
|
|
|
def list_users(tenant_id = nil)
|
2012-12-10 21:12:28 -05:00
|
|
|
users = self.data[:users].values
|
|
|
|
|
|
|
|
if tenant_id
|
|
|
|
users = users.select {
|
|
|
|
|user| user['tenantId'] == tenant_id
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-05-28 17:45:22 -04:00
|
|
|
Excon::Response.new(
|
2012-12-10 21:12:28 -05:00
|
|
|
:body => { 'users' => users },
|
2012-05-28 17:45:22 -04:00
|
|
|
:status => 200
|
|
|
|
)
|
2012-02-26 21:43:42 -05:00
|
|
|
end
|
2012-02-22 09:40:32 -05:00
|
|
|
end # class Mock
|
|
|
|
end # class OpenStack
|
|
|
|
end # module Identity
|
|
|
|
end # module Fog
|