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:
parent
69bdbe00b8
commit
bfc882c7e0
3 changed files with 49 additions and 6 deletions
|
@ -96,11 +96,13 @@ module Fog
|
|||
end
|
||||
|
||||
response.headers = {
|
||||
'Content-Length' => object['Content-Length'],
|
||||
'Content-Type' => object['Content-Type'],
|
||||
'ETag' => object['ETag'],
|
||||
'Last-Modified' => object['Last-Modified']
|
||||
'Content-Length' => object['Content-Length'],
|
||||
'Content-Type' => object['Content-Type'],
|
||||
'ETag' => object['ETag'],
|
||||
'Last-Modified' => object['Last-Modified'],
|
||||
}
|
||||
|
||||
response.headers['x-amz-version-id'] = object['VersionId'] if object['VersionId'] != 'null'
|
||||
else
|
||||
response.status = 404
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
Fog.mock!
|
||||
|
||||
Shindo.tests("Storage[aws] | directory", [:aws]) do
|
||||
Shindo.tests("Storage[:aws] | directory", [:aws]) do
|
||||
|
||||
directory_attributes = {
|
||||
: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=(true)").succeeds do
|
41
tests/aws/models/storage/file_tests.rb
Normal file
41
tests/aws/models/storage/file_tests.rb
Normal 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
|
Loading…
Reference in a new issue