mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[storage] public_url related tests/fixes
This commit is contained in:
parent
b60bdd37da
commit
acb4a06431
3 changed files with 11 additions and 4 deletions
|
@ -83,7 +83,7 @@ module Fog
|
|||
requires :directory, :key
|
||||
if connection.get_object_acl(directory.key, key).body['AccessControlList'].detect {|entry| entry['Scope']['type'] == 'AllUsers' && entry['Permission'] == 'READ'}
|
||||
if directory.key.to_s =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
|
||||
"https://#{directory.key}.commondatastorage.googleapis/#{key}"
|
||||
"https://#{directory.key}.commondatastorage.googleapis.com/#{key}"
|
||||
else
|
||||
"https://commondatastorage.googleapis.com/#{directory.key}/#{key}"
|
||||
end
|
||||
|
|
|
@ -109,6 +109,10 @@ module Fog
|
|||
def self.data
|
||||
@data ||= Hash.new do |hash, key|
|
||||
hash[key] = {
|
||||
:acls => {
|
||||
:bucket => {},
|
||||
:object => {}
|
||||
},
|
||||
:buckets => {}
|
||||
}
|
||||
end
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
def file_tests(connection, params = {}, mocks_implemented = true)
|
||||
|
||||
params = {:key => 'fog_file_tests', :body => lorem_file}.merge!(params)
|
||||
params = {:key => 'fog_file_tests', :body => lorem_file, :public => true}.merge!(params)
|
||||
|
||||
if !Fog.mocking? || mocks_implemented
|
||||
@directory = connection.directories.create(:key => 'fogfilestests')
|
||||
|
||||
model_tests(@directory.files, params, mocks_implemented) do
|
||||
|
||||
responds_to(:public_url)
|
||||
|
||||
tests("#public=(true)").succeeds do
|
||||
pending if Fog.mocking? && !mocks_implemented
|
||||
@instance.public=(true)
|
||||
end
|
||||
|
||||
tests("#respond_to?(:public_url)").succeeds do
|
||||
@instance.respond_to?(:public_url)
|
||||
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
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue