2012-06-14 00:13:56 -04:00
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
Shindo.tests('AWS | url') do
|
|
|
|
|
|
|
|
@expires = DateTime.parse('2013-01-01T00:00:00Z').to_time.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')
|
|
|
|
|
2012-06-29 06:38:25 -04:00
|
|
|
if Fog.mock?
|
|
|
|
signature = Fog::Storage::AWS.new.signature(nil)
|
|
|
|
else
|
|
|
|
signature = 'tajHIhKHAdFYsigmzybCpaq8N0Q%3D'
|
|
|
|
end
|
|
|
|
|
2012-06-14 00:13:56 -04:00
|
|
|
tests('#url w/ response-cache-control').returns(
|
2012-06-29 06:38:25 -04:00
|
|
|
"https://fognonbucket.s3.amazonaws.com/test.txt?response-cache-control=No-cache&AWSAccessKeyId=123&Signature=#{signature}&Expires=1356998400"
|
2012-06-14 00:13:56 -04:00
|
|
|
) do
|
|
|
|
@file.url(@expires, query: { 'response-cache-control' => 'No-cache' })
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|