mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
add IAM mocking for get_group method
This commit is contained in:
parent
214f732a93
commit
9625d7f1ed
1 changed files with 18 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue