mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Added mock for Fog::Identity#get_user_by_name
OpenStack does not support filtering by name as in the real method so the mock returns all users regardless of the name query parameter. See: http://docs.openstack.org/api/openstack-identity-service/2.0/content/GET_listUsers_v2.0_users_Admin_API_Service_Developer_Operations-d1e1356.html
This commit is contained in:
parent
398f706e7e
commit
b430ec6a20
2 changed files with 17 additions and 0 deletions
|
@ -15,6 +15,15 @@ module Fog
|
|||
|
||||
class Mock
|
||||
|
||||
def get_user_by_name(name)
|
||||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
|
||||
response.body = {
|
||||
'users' => self.data[:users].values
|
||||
}
|
||||
response
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -17,6 +17,14 @@ Shindo.tests('Fog::Identity[:openstack] | user requests', ['openstack']) do
|
|||
Fog::Identity[:openstack].list_users.body
|
||||
end
|
||||
|
||||
tests('#get_user_by_id').formats(@user_format) do
|
||||
Fog::Identity[:openstack].get_user_by_id(@user['id']).body['user']
|
||||
end
|
||||
|
||||
tests('#get_user_by_name').formats({'users' => [@user_format]}) do
|
||||
Fog::Identity[:openstack].get_user_by_name(@user['name']).body
|
||||
end
|
||||
|
||||
tests("#update_user(#{@user['id']}, :name => 'fogupdateduser')").succeeds do
|
||||
Fog::Identity[:openstack].update_user(@user['id'], :name => 'fogupdateduser', :email => 'fog@test.com')
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue