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

Merge pull request #994 from restebanez/feature/add-iam-get-group-mocking

[AWS | IAM ] Feature/add iam get group mocking
This commit is contained in:
Dylan Egan 2012-06-19 05:26:12 -07:00
commit c2ed3c886d

View file

@ -39,6 +39,24 @@ module Fog
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