2013-01-31 14:40:38 -05:00
|
|
|
Shindo.tests("Storage[:internet_archive] | directory", ["internet_archive"]) do
|
|
|
|
|
|
|
|
directory_attributes = {
|
2013-03-26 17:21:57 -04:00
|
|
|
:key => "fogdirectorytests-#{rand(65536)}",
|
|
|
|
:collections => ['test_collection']
|
2013-01-31 14:40:38 -05:00
|
|
|
}
|
|
|
|
|
2013-03-06 14:06:26 -06:00
|
|
|
tests('success') do
|
|
|
|
params = directory_attributes
|
|
|
|
mocks_implemented = Fog.mocking?
|
2013-01-31 14:40:38 -05:00
|
|
|
|
2013-03-06 14:06:26 -06:00
|
|
|
collection = Fog::Storage[:internetarchive].directories
|
|
|
|
@instance = collection.new(params)
|
2013-03-06 12:14:03 -06:00
|
|
|
|
2013-03-06 14:06:26 -06:00
|
|
|
tests("#save").succeeds do
|
|
|
|
pending if Fog.mocking? && !mocks_implemented
|
|
|
|
@instance.save
|
|
|
|
end
|
2013-01-31 14:40:38 -05:00
|
|
|
|
2013-03-26 17:21:57 -04:00
|
|
|
tests("#public_url").returns("http://archive.org/details/#{directory_attributes[:key]}") do
|
|
|
|
@instance.public_url
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#set_metadata_array_headers") do
|
|
|
|
params = directory_attributes
|
|
|
|
|
|
|
|
collection = Fog::Storage[:internetarchive].directories
|
|
|
|
@instance = collection.new(params)
|
|
|
|
|
|
|
|
@instance.collections = ['test_collection', 'opensource']
|
|
|
|
@options = {}
|
|
|
|
@instance.set_metadata_array_headers(:collections, @options)
|
|
|
|
|
|
|
|
tests("#set_metadata_array_headers should set options").returns(true) do
|
|
|
|
@options['x-archive-meta01-collection'] == 'opensource' &&
|
|
|
|
@options['x-archive-meta02-collection'] == 'test_collection'
|
|
|
|
end
|
2013-01-31 14:40:38 -05:00
|
|
|
end
|
|
|
|
|
2013-03-26 17:21:57 -04:00
|
|
|
|
2013-01-31 14:40:38 -05:00
|
|
|
end
|