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

[aws|storage] Add mock for Fog::Storage::AWS#put_bucket_website

This commit is contained in:
Garret Alfert 2012-01-08 03:08:56 +01:00
parent f07e59472f
commit d91d4e1cc6
2 changed files with 21 additions and 1 deletions

View file

@ -44,6 +44,23 @@ DATA
end
end
class Mock # :nodoc:all
def put_bucket_website(bucket_name, suffix, options = {})
response = Excon::Response.new
if self.data[:buckets][bucket_name]
response.status = 200
else
response.status = 403
raise(Excon::Errors.status_error({:expects => 200}, response))
end
response
end
end
end
end
end

View file

@ -117,7 +117,6 @@ Shindo.tests('Fog::Storage[:aws] | bucket requests', [:aws]) do
end
tests("#put_bucket_website('#{@aws_bucket_name}', 'index.html')").succeeds do
pending if Fog.mocking?
Fog::Storage[:aws].put_bucket_website(@aws_bucket_name, 'index.html')
end
@ -222,6 +221,10 @@ Shindo.tests('Fog::Storage[:aws] | bucket requests', [:aws]) do
Fog::Storage[:aws].put_bucket_acl('fognonbucket', 'invalid')
end
tests("#put_bucket_website('fognonbucket', 'index.html')").raises(Excon::Errors::Forbidden) do
Fog::Storage[:aws].put_bucket_website('fognonbucket', 'index.html')
end
end
# don't keep the bucket around