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

Merged
merged 1 commit into from Jan 10, 2012
@@ -44,6 +44,23 @@ def put_bucket_website(bucket_name, suffix, options = {})
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
@@ -117,7 +117,6 @@
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 @@
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