2013-01-31 14:40:38 -05:00
|
|
|
Shindo.tests("Storage[:internet_archive] | files", ["internet_archive"]) do
|
|
|
|
|
|
|
|
file_attributes = {
|
|
|
|
:key => 'fog_file_tests',
|
|
|
|
:body => lorem_file,
|
2013-03-06 15:06:26 -05:00
|
|
|
:public => true,
|
|
|
|
:auto_make_bucket => 1,
|
|
|
|
:collections => ['test_collection']
|
2013-01-31 14:40:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
directory_attributes = {
|
2013-03-06 15:06:26 -05:00
|
|
|
:key => "fogfilestests-#{rand(65536)}"
|
2013-01-31 14:40:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@directory = Fog::Storage[:internetarchive].directories.create(directory_attributes)
|
2013-03-06 13:14:03 -05:00
|
|
|
# @directory.versioning = true
|
2013-01-31 14:40:38 -05:00
|
|
|
|
|
|
|
model_tests(@directory.files, file_attributes, Fog.mocking?) do
|
|
|
|
|
2013-03-06 15:06:26 -05:00
|
|
|
@instance
|
2013-03-06 13:14:03 -05:00
|
|
|
# v2 = @directory.connection.put_object(@directory.key, @instance.key, 'version 2 content').headers['x-amz-version-id']
|
|
|
|
# v3 = @directory.connection.delete_object(@directory.key, @instance.key).headers['x-amz-version-id']
|
|
|
|
# v4 = @directory.connection.put_object(@directory.key, @instance.key, 'version 3 content').headers['x-amz-version-id']
|
|
|
|
|
|
|
|
# tests("#get") do
|
|
|
|
# tests("#get without version fetches the latest version").returns(v4) do
|
|
|
|
# @directory.files.get(@instance.key).version
|
|
|
|
# end
|
|
|
|
|
|
|
|
# tests("#get with version fetches that exact version").returns(v2) do
|
|
|
|
# @directory.files.get(@instance.key, 'versionId' => v2).version
|
|
|
|
# end
|
|
|
|
|
|
|
|
# tests("#get with a deleted version returns nil").returns(nil) do
|
|
|
|
# @directory.files.get(@instance.key, 'versionId' => v3)
|
|
|
|
# end
|
|
|
|
# end
|
|
|
|
|
|
|
|
# tests("#head") do
|
|
|
|
# tests("#head without version fetches the latest version").returns(v4) do
|
|
|
|
# @directory.files.head(@instance.key).version
|
|
|
|
# end
|
|
|
|
|
|
|
|
# tests("#head with version fetches that exact version").returns(v2) do
|
|
|
|
# @directory.files.head(@instance.key, 'versionId' => v2).version
|
|
|
|
# end
|
|
|
|
|
|
|
|
# tests("#head with a deleted version returns nil").returns(nil) do
|
|
|
|
# @directory.files.head(@instance.key, 'versionId' => v3)
|
|
|
|
# end
|
|
|
|
# end
|
2013-01-31 14:40:38 -05:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2013-03-06 13:14:03 -05:00
|
|
|
# @directory.versions.each(&:destroy)
|
|
|
|
# @directory.destroy
|
2013-01-31 14:40:38 -05:00
|
|
|
|
|
|
|
end
|