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

Merge pull request #687 from 5apps/mock_put_bucket_website

[aws|storage] Add mock for Fog::Storage::AWS#put_bucket_website
This commit is contained in:
Wesley Beary 2012-01-10 11:35:54 -08:00
commit d97384b19e
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