diff --git a/lib/fog/aws/requests/iam/get_user.rb b/lib/fog/aws/requests/iam/get_user.rb index f215805d2..e69552a8f 100644 --- a/lib/fog/aws/requests/iam/get_user.rb +++ b/lib/fog/aws/requests/iam/get_user.rb @@ -8,6 +8,7 @@ module Fog # Get User # # ==== Parameters + # * username # * 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 diff --git a/tests/aws/requests/iam/user_tests.rb b/tests/aws/requests/iam/user_tests.rb index 21d8c1a19..4f99f914f 100644 --- a/tests/aws/requests/iam/user_tests.rb +++ b/tests/aws/requests/iam/user_tests.rb @@ -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