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:
parent
cd5028417a
commit
2d7b5784ed
2 changed files with 22 additions and 1 deletions
|
@ -21,6 +21,28 @@ module Fog
|
|||
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
|
||||
|
|
|
@ -11,7 +11,6 @@ Shindo.tests('Fog::Storage[:rackspace] | container requests', ["rackspace"]) do
|
|||
tests('success') do
|
||||
|
||||
tests("#put_container('fogcontainertests', {})").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].put_container('fogcontainertests')
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue