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:
parent
f07e59472f
commit
d91d4e1cc6
2 changed files with 21 additions and 1 deletions
|
@ -44,6 +44,23 @@ DATA
|
||||||
end
|
end
|
||||||
|
|
||||||
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -117,7 +117,6 @@ Shindo.tests('Fog::Storage[:aws] | bucket requests', [:aws]) do
|
||||||
end
|
end
|
||||||
|
|
||||||
tests("#put_bucket_website('#{@aws_bucket_name}', 'index.html')").succeeds do
|
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')
|
Fog::Storage[:aws].put_bucket_website(@aws_bucket_name, 'index.html')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -222,6 +221,10 @@ Shindo.tests('Fog::Storage[:aws] | bucket requests', [:aws]) do
|
||||||
Fog::Storage[:aws].put_bucket_acl('fognonbucket', 'invalid')
|
Fog::Storage[:aws].put_bucket_acl('fognonbucket', 'invalid')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
tests("#put_bucket_website('fognonbucket', 'index.html')").raises(Excon::Errors::Forbidden) do
|
||||||
|
Fog::Storage[:aws].put_bucket_website('fognonbucket', 'index.html')
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# don't keep the bucket around
|
# don't keep the bucket around
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue