mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
65a90fd655
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).
31 lines
607 B
Ruby
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
|