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?
|
2013-04-12 06:31:10 -04:00
|
|
|
signature = Fog::Storage::AWS.new.signature(nil, nil)
|
2012-06-29 06:38:25 -04:00
|
|
|
else
|
|
|
|
signature = 'tajHIhKHAdFYsigmzybCpaq8N0Q%3D'
|
|
|
|
end
|
|
|
|
|
2013-04-12 06:31:10 -04:00
|
|
|
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
|
2012-06-14 00:13:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|