Skip to content

Commit

Permalink
add IAM mocking for get_group method
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodrigo Estebanez committed Jun 18, 2012
1 parent 7423365 commit 65755ef
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/fog/aws/requests/iam/get_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,24 @@ def get_group(group_name, options = {})
end

end
class Mock
def get_group(group_name, options = {})
raise Fog::AWS::IAM::NotFound.new(
"The user with name #{group_name} cannot be found."
) unless self.data[:groups].key?(group_name)
Excon::Response.new.tap do |response|
response.body = { 'Group' => {
'GroupId' => data[:groups][group_name][:group_id],
'Path' => data[:groups][group_name][:path],
'GroupName' => group_name,
'Arn' => (data[:groups][group_name][:arn]).strip
},
'Users' => data[:groups][group_name][:members].map { |user| get_user(user).body['User'] },
'RequestId' => Fog::AWS::Mock.request_id }
response.status = 200
end
end
end
end
end
end

0 comments on commit 65755ef

Please sign in to comment.