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

Additional mocks

This commit is contained in:
Edward Muller 2012-02-06 17:55:44 -08:00
parent 5171df8ede
commit 4c8ca82b6c
14 changed files with 219 additions and 20 deletions

View file

@ -29,6 +29,30 @@ module Fog
end
end
class Mock
def add_user_to_group(group_name, user_name)
if data[:groups].has_key? group_name
if data[:users].has_key? user_name
unless data[:groups][group_name][:members].include?(user_name)
data[:groups][group_name][:members] << user_name
end
Excon::Response.new.tap do |response|
response.status = 200
response.body = { 'RequestId' => Fog::AWS::Mock.request_id }
end
else
raise Fog::AWS::IAM::NotFound.new("The user with name #{user_name} cannot be found.")
end
else
raise Fog::AWS::IAM::NotFound.new("The group with name #{group_name} cannot be found.")
end
end
end
end
end
end