mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
f6d361b2e2
Logics have been centralised: * region to hostname * url generation * signature * chaning scheme also changes the port During the process a couple of inconsistencies have also been fixed. Known limitations: When using the @endpoint with a custom port you need to specify the port when using get_object_http_url or get_object_https_url. When using bucket names that contain dots outside of us-east-1 make sure to access it with the same region in your AWS::Storage.
30 lines
865 B
Ruby
30 lines
865 B
Ruby
# encoding: utf-8
|
|
|
|
Shindo.tests('AWS | url', ["aws"]) do
|
|
|
|
@expires = Time.utc(2013,1,1).utc.to_i
|
|
|
|
@storage = Fog::Storage.new(
|
|
:provider => 'AWS',
|
|
:aws_access_key_id => '123',
|
|
:aws_secret_access_key => 'abc',
|
|
:region => 'us-east-1'
|
|
)
|
|
|
|
@file = @storage.directories.new(:key => 'fognonbucket').files.new(:key => 'test.txt')
|
|
|
|
if Fog.mock?
|
|
signature = Fog::Storage::AWS.new.signature(nil, nil)
|
|
else
|
|
signature = 'tajHIhKHAdFYsigmzybCpaq8N0Q%3D'
|
|
end
|
|
|
|
if RUBY_VERSION > '1.8.7' # ruby 1.8.x doesn't provide hash ordering
|
|
tests('#url w/ response-cache-control').returns(
|
|
"https://fognonbucket.s3.amazonaws.com/test.txt?response-cache-control=No-cache&AWSAccessKeyId=123&Signature=#{signature}&Expires=1356998400"
|
|
) do
|
|
@file.url(@expires, :query => { 'response-cache-control' => 'No-cache' })
|
|
end
|
|
end
|
|
|
|
end
|