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

file_tests now all pass under mocking.

put_object persists certain object headers like Content-Disposition.
This commit is contained in:
Ash Wilson 2013-12-20 09:19:32 -05:00
parent 66964e9410
commit 862547921c
2 changed files with 17 additions and 3 deletions

View file

@ -39,6 +39,11 @@ module Fog
end
class Mock
HeaderOptions = %w{
Content-Type Access-Control-Allow-Origin Origin Content-Disposition
Etag Content-Encoding
}.freeze
def put_object(container, object, data, options = {}, &block)
c = mock_container! container
@ -51,7 +56,18 @@ module Fog
end
end
c.add_object object, data
o = c.add_object object, data
options.keys.each do |k|
o.meta[k] = options[k].to_s if k =~ /^X-Object-Meta/
o.meta[k] = options[k] if HeaderOptions.include? k
end
# Validate the provided Etag
etag = o.meta['Etag']
if etag && etag != o.hash
c.remove_object object
raise Fog::Storage::Rackspace::ServiceError.new
end
response = Excon::Response.new
response.status = 201

View file

@ -30,8 +30,6 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do
end
end
pending if Fog.mocking?
def object_attributes(file=@instance)
@instance.service.head_object(@directory.key, file.key).headers
end