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

Mock the #put_container Storage request.

This commit is contained in:
Ash Wilson 2013-12-16 17:13:55 -05:00
parent cd5028417a
commit 2d7b5784ed
2 changed files with 22 additions and 1 deletions

View file

@ -21,6 +21,28 @@ module Fog
end end
end end
class Mock
def put_container(name, options={})
escaped = Fog::Rackspace.escape(name)
response = Excon::Response.new
meta = {}
options.keys.each do |k|
meta[k] = options[k] if k =~ /^X-Container-Meta/
end
meta['X-Container-Object-Count'] = 0
meta['X-Container-Bytes-Used'] = 0
data[escaped] = { :meta => meta }
if data.has_key?(escaped)
response.status = 202 # Accepted
else
response.status = 201 # Created
end
response
end
end
end end
end end
end end

View file

@ -11,7 +11,6 @@ Shindo.tests('Fog::Storage[:rackspace] | container requests', ["rackspace"]) do
tests('success') do tests('success') do
tests("#put_container('fogcontainertests', {})").succeeds do tests("#put_container('fogcontainertests', {})").succeeds do
pending if Fog.mocking?
Fog::Storage[:rackspace].put_container('fogcontainertests') Fog::Storage[:rackspace].put_container('fogcontainertests')
end end