2012-06-14 00:13:56 -04:00
|
|
|
# encoding: utf-8
|
|
|
|
|
2012-08-15 11:33:33 -04:00
|
|
|
Shindo.tests('AWS | url', ["aws"]) do
|
2012-06-14 00:13:56 -04:00
|
|
|
|
2012-09-02 08:17:12 -04:00
|
|
|
@expires = Time.utc(2013,1,1).utc.to_i
|
2012-06-14 00:13:56 -04:00
|
|
|
|
|
|
|
@storage = Fog::Storage.new(
|
2012-08-14 05:45:16 -04:00
|
|
|
:provider => 'AWS',
|
|
|
|
:aws_access_key_id => '123',
|
|
|
|
:aws_secret_access_key => 'abc',
|
|
|
|
:region => 'us-east-1'
|
2012-06-14 00:13:56 -04:00
|
|
|
)
|
|
|
|
|
2012-08-14 05:45:16 -04:00
|
|
|
@file = @storage.directories.new(:key => 'fognonbucket').files.new(:key => 'test.txt')
|
2012-06-14 00:13:56 -04:00
|
|
|
|
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
|
2012-08-14 05:45:16 -04:00
|
|
|
@file.url(@expires, :query => { 'response-cache-control' => 'No-cache' })
|
2012-06-14 00:13:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|