2011-01-03 14:23:51 -05:00
|
|
|
for provider, config in storage_providers
|
2010-11-16 18:31:34 -05:00
|
|
|
|
2012-08-15 11:19:32 -04:00
|
|
|
Shindo.tests("Storage[:#{provider}] | file", [provider.to_s]) do
|
2010-11-03 21:17:20 -04:00
|
|
|
|
2011-01-03 14:23:51 -05:00
|
|
|
if !Fog.mocking? || config[:mocked]
|
2010-12-29 21:12:51 -05:00
|
|
|
|
2011-05-24 20:32:27 -04:00
|
|
|
file_attributes = {
|
|
|
|
:key => 'fog_file_tests',
|
|
|
|
:body => lorem_file,
|
|
|
|
:public => true
|
|
|
|
}.merge!(config[:file_attributes] || {})
|
|
|
|
|
2011-01-03 18:38:20 -05:00
|
|
|
directory_attributes = {
|
|
|
|
:key => 'fogfilestests'
|
|
|
|
}.merge!(config[:directory_attributes] || {})
|
2010-11-03 21:17:20 -04:00
|
|
|
|
2011-06-15 17:26:43 -04:00
|
|
|
@directory = Fog::Storage[provider].directories.create(directory_attributes)
|
2011-01-03 18:38:20 -05:00
|
|
|
|
|
|
|
model_tests(@directory.files, file_attributes, config[:mocked]) do
|
2010-11-18 18:54:54 -05:00
|
|
|
|
2011-01-03 14:23:51 -05:00
|
|
|
responds_to(:public_url)
|
|
|
|
|
|
|
|
tests("#public=(true)").succeeds do
|
2012-07-02 09:03:07 -04:00
|
|
|
pending if Fog.mocking? && !config[:mocked] || !Fog::Storage[provider].respond_to?(:public=)
|
2011-01-03 14:23:51 -05:00
|
|
|
@instance.public=(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
test("@instance.public_url.nil? || Excon.get(@instance.public_url).body == lorem_file.read") do
|
|
|
|
pending if Fog.mocking?
|
|
|
|
@instance.public_url.nil? || Excon.get(@instance.public_url).body == lorem_file.read
|
|
|
|
end
|
2010-11-18 14:18:46 -05:00
|
|
|
|
2010-11-16 18:31:34 -05:00
|
|
|
end
|
2010-11-05 14:37:12 -04:00
|
|
|
|
2011-01-03 14:23:51 -05:00
|
|
|
@directory.destroy
|
2010-11-03 21:17:20 -04:00
|
|
|
|
2011-01-03 14:23:51 -05:00
|
|
|
end
|
2010-12-29 21:12:51 -05:00
|
|
|
|
2010-11-03 21:17:20 -04:00
|
|
|
end
|
|
|
|
|
2010-11-11 14:54:55 -05:00
|
|
|
end
|