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

Some speculative mocking of #get_container.

Currently calls methods on a MockFile class that doesn't exist. Also, it looks
like the #get_container tests currently pass vacuously; they're called on an
empty container in mocking mode.
This commit is contained in:
Ash Wilson 2013-12-16 17:20:07 -05:00
parent 901e8dbeaa
commit 0cc9b10666
2 changed files with 29 additions and 1 deletions

View file

@ -43,6 +43,28 @@ module Fog
end
end
class Mock
def get_container(container, options = {})
escaped = Fog::Rackspace.escape(container)
unless data.has_key?(escaped)
raise Fog::Storage::Rackspace::NotFound.new
end
results = []
data[escaped].each do |key, mock_file|
next if key == :meta
results << mock_file.to_h
end
response = Excon::Response.new
response.status = 200
response.body = results
response
end
end
end
end
end

View file

@ -1,6 +1,12 @@
Shindo.tests('Fog::Storage[:rackspace] | container requests', ["rackspace"]) do
@container_format = [String]
@container_format = [{
'hash' => String,
'last_modified' => String,
'bytes' => Integer,
'name' => String,
'content_type' => String
}]
@containers_format = [{
'bytes' => Integer,