2013-10-28 16:05:28 -04:00
|
|
|
Shindo.tests("Fog::Rackspace::Storage | files", ['rackspace', 'storage']) do
|
|
|
|
|
|
|
|
file_attributes = {
|
|
|
|
:key => 'fog_files_tests',
|
|
|
|
:body => lorem_file
|
|
|
|
}
|
|
|
|
|
|
|
|
directory_attributes = {
|
|
|
|
:key => 'fogfilestests',
|
|
|
|
:public => true
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-29 12:10:07 -04:00
|
|
|
tests('success') do
|
2013-12-20 10:46:44 -05:00
|
|
|
collection_tests(Fog::Storage[:rackspace].directories.create(directory_attributes).files, file_attributes, Fog.mocking?)
|
2013-10-28 16:05:28 -04:00
|
|
|
|
2013-10-29 12:10:07 -04:00
|
|
|
@service = Fog::Storage.new :provider => 'rackspace', :rackspace_temp_url_key => "my_secret"
|
2013-10-28 16:05:28 -04:00
|
|
|
|
2013-10-29 12:10:07 -04:00
|
|
|
@directory = @service.directories.create(directory_attributes)
|
|
|
|
@file = @directory.files.create(file_attributes)
|
2013-10-28 16:05:28 -04:00
|
|
|
|
|
|
|
tests("#get_url('#{@directory.key}')").succeeds do
|
|
|
|
@directory.files.get_url(@directory.key)
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#get_http_url('#{@directory.key}')").succeeds do
|
|
|
|
expire_time = Time.now + 3600
|
|
|
|
@directory.files.get_http_url(@file.key, expire_time)
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#get_https_url('#{@directory.key}', '#{@file.key}')").succeeds do
|
|
|
|
expire_time = Time.now + 3600
|
|
|
|
@directory.files.get_https_url(@file.key, expire_time)
|
|
|
|
end
|
|
|
|
|
2013-10-29 12:10:07 -04:00
|
|
|
@file.destroy
|
|
|
|
@directory.destroy
|
2013-10-28 16:05:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|