mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
add failing test and update Mock list_users to filter based on tenant_id
This commit is contained in:
parent
4aac224ba6
commit
7f69c47b94
2 changed files with 16 additions and 1 deletions
|
@ -14,8 +14,17 @@ module Fog
|
|||
|
||||
class Mock
|
||||
def list_users(tenant_id = nil)
|
||||
users = self.data[:users].values
|
||||
|
||||
if tenant_id
|
||||
users = users.select {
|
||||
|user| user['tenantId'] == tenant_id
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
Excon::Response.new(
|
||||
:body => { 'users' => self.data[:users].values },
|
||||
:body => { 'users' => users },
|
||||
:status => 200
|
||||
)
|
||||
end
|
||||
|
|
|
@ -4,6 +4,12 @@ Shindo.tests("Fog::Identity[:openstack] | tenant", ['openstack']) do
|
|||
instance = Fog::Identity[:openstack].tenants.first
|
||||
instance.roles_for(0)
|
||||
end
|
||||
|
||||
tests('#users').succeeds do
|
||||
instance = Fog::Identity[:openstack].tenants.first
|
||||
|
||||
instance.users.count != Fog::Identity[:openstack].users.count
|
||||
end
|
||||
end
|
||||
|
||||
tests('CRUD') do
|
||||
|
|
Loading…
Reference in a new issue