1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[aws|iam] FIX - make arguments AWS::IAM.get_user conform to expected standard for this module

This commit is contained in:
Benton Roberts 2012-06-13 10:12:57 -04:00
parent 907f294e8f
commit cdd8c20812
2 changed files with 10 additions and 8 deletions

View file

@ -8,6 +8,7 @@ module Fog
# Get User
#
# ==== Parameters
# * username<String>
# * options<~Hash>:
# * 'UserName'<~String>: Name of the User. Defaults to current user
#
@ -23,19 +24,21 @@ module Fog
# ==== See Also
# http://docs.amazonwebservices.com/IAM/latest/APIReference/API_Getuser.html
#
def get_user(options = {})
def get_user(username, options = {})
request({
'Action' => 'GetUser',
:parser => Fog::Parsers::AWS::IAM::GetUser.new
'Action' => 'GetUser',
'UserName' => username,
:parser => Fog::Parsers::AWS::IAM::GetUser.new
}.merge!(options))
end
end
class Mock
def get_user(options = {})
user = options['UserName']
raise Fog::AWS::IAM::NotFound.new("The user with name #{user} cannot be found.") unless self.data[:users].key?(user)
def get_user(user, options = {})
raise Fog::AWS::IAM::NotFound.new(
"The user with name #{user} cannot be found."
) unless self.data[:users].key?(user)
Excon::Response.new.tap do |response|
response.body = {'User' => {
'UserId' => data[:users][user][:user_id],
@ -43,7 +46,6 @@ module Fog
'UserName' => user,
'Arn' => (data[:users][user][:arn]).strip
},
'IsTruncated' => false,
'RequestId' => Fog::AWS::Mock.request_id }
response.status = 200
end

View file

@ -34,7 +34,7 @@ Shindo.tests('AWS::IAM | user requests', ['aws']) do
end
tests("#get_user").formats(@user_format) do
Fog::AWS[:iam].get_user('UserName' => 'fog_user').body
Fog::AWS[:iam].get_user('fog_user').body
end
tests("#add_user_to_group('fog_user_tests', 'fog_user')").formats(AWS::IAM::Formats::BASIC) do