mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[openstack|identity] Add User List and Delete User Mocks
Signed-off-by: Nelvin Driz <nelvindriz@live.com>
This commit is contained in:
parent
92523f763a
commit
33471086de
2 changed files with 8 additions and 8 deletions
|
@ -16,14 +16,14 @@ module Fog
|
||||||
class Mock
|
class Mock
|
||||||
|
|
||||||
def delete_user(user_id)
|
def delete_user(user_id)
|
||||||
|
self.data[:users].delete(
|
||||||
|
list_users.body['users'].find {|x| x['id'] == user_id }['id'])
|
||||||
|
|
||||||
response = Excon::Response.new
|
response = Excon::Response.new
|
||||||
if user = list_users.body['users'][user_id]
|
response.status = 204
|
||||||
self.data[:users].delete(user_id)
|
response
|
||||||
response.status = 204
|
rescue
|
||||||
response
|
raise Fog::Identity::OpenStack::NotFound
|
||||||
else
|
|
||||||
raise Fog::Identity::OpenStack::NotFound
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ module Fog
|
||||||
def list_users
|
def list_users
|
||||||
response = Excon::Response.new
|
response = Excon::Response.new
|
||||||
response.status = 200
|
response.status = 200
|
||||||
response.body = { 'users' => self.data[:users] }
|
response.body = { 'users' => self.data[:users].values }
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
end # class Mock
|
end # class Mock
|
||||||
|
|
Loading…
Add table
Reference in a new issue