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/get_user_by_name.rb
Dan Prince 65a90fd655 OpenStack: get identity tests passing in real mode
Updates to the OpenStack identity tests to they pass in both real
and mock modes.

Also, fixes an issue in the delete_user_role request where it
was expecting 200 instead of 204 (which seems to match the
spec and implementation).
2013-01-28 13:07:22 -05:00

31 lines
607 B
Ruby

module Fog
module Identity
class OpenStack
class Real
def get_user_by_name(name)
request(
:expects => [200, 203],
:method => 'GET',
:path => "users?name=#{name}"
)
end
end
class Mock
def get_user_by_name(name)
response = Excon::Response.new
response.status = 200
user = self.data[:users].values.select {|user| user['name'] == name}[0]
response.body = {
'user' => user
}
response
end
end
end
end
end