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

[aws|storage|test] Added in some file and directory model tests.

This commit is contained in:
Kevin Menard 2012-01-19 18:19:03 -05:00
parent 69bdbe00b8
commit bfc882c7e0
3 changed files with 49 additions and 6 deletions

View file

@ -99,8 +99,10 @@ module Fog
'Content-Length' => object['Content-Length'], 'Content-Length' => object['Content-Length'],
'Content-Type' => object['Content-Type'], 'Content-Type' => object['Content-Type'],
'ETag' => object['ETag'], 'ETag' => object['ETag'],
'Last-Modified' => object['Last-Modified'] 'Last-Modified' => object['Last-Modified'],
} }
response.headers['x-amz-version-id'] = object['VersionId'] if object['VersionId'] != 'null'
else else
response.status = 404 response.status = 404
raise(Excon::Errors.status_error({:expects => 200}, response)) raise(Excon::Errors.status_error({:expects => 200}, response))

View file

@ -1,12 +1,12 @@
Fog.mock! Fog.mock!
Shindo.tests("Storage[aws] | directory", [:aws]) do Shindo.tests("Storage[:aws] | directory", [:aws]) do
directory_attributes = { directory_attributes = {
:key => 'fogdirectorytests' :key => 'fogdirectorytests'
} }
model_tests(Fog::Storage[:aws].directories, directory_attributes, true) do model_tests(Fog::Storage[:aws].directories, directory_attributes, Fog.mocking?) do
tests("#versioning=") do tests("#versioning=") do
tests("#versioning=(true)").succeeds do tests("#versioning=(true)").succeeds do

View file

@ -0,0 +1,41 @@
Fog.mock!
Shindo.tests("Storage[:aws] | file", [:aws]) do
file_attributes = {
:key => 'fog_file_tests',
:body => lorem_file,
:public => true
}
directory_attributes = {
:key => 'fogfilestests'
}
@directory = Fog::Storage[:aws].directories.create(directory_attributes)
model_tests(@directory.files, file_attributes, Fog.mocking?) do
tests("#version") do
tests("#version should be null if versioning isn't enabled").returns(nil) do
@instance.version
end
end
end
@directory.versioning = true
model_tests(@directory.files, file_attributes, Fog.mocking?) do
tests("#version") do
tests("#version should not be null if versioning is enabled").returns(false) do
@instance.version == nil
end
end
end
@directory.destroy
end