Sha256: 0b50d93514a8dd77ad1de76f0fe6a9af0a172609b100d8b6d0dc0dc2ff9d2752

Contents?: true

Size: 1.52 KB

Versions: 35

Compression:

Stored size: 1.52 KB

Contents

# encoding: utf-8
Shindo.tests('AWS | url', ["aws"]) do


  @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')

  now = Fog::Time.now
  if RUBY_VERSION > '1.8.7' # ruby 1.8.x doesn't provide hash ordering
    tests('#v4 url w/ response-cache-control').returns(
      "https://fognonbucket.s3.amazonaws.com/test.txt?response-cache-control=No-cache&X-Amz-Expires=500&X-Amz-Date=#{now.to_iso8601_basic}&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=123/#{now.utc.strftime('%Y%m%d')}/us-east-1/s3/aws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature="
    ) do

      @file.url(now + 500, :query => { 'response-cache-control' => 'No-cache' }).gsub(/(X-Amz-Signature=)[0-9a-f]+\z/,'\\1')
    end
  end

  @storage = Fog::Storage.new(
    :provider => 'AWS',
    :aws_access_key_id => '123',
    :aws_secret_access_key => 'abc',
    :aws_signature_version => 2,
    :region => 'us-east-1'
  )

  @file = @storage.directories.new(:key => 'fognonbucket').files.new(:key => 'test.txt')

  if RUBY_VERSION > '1.8.7' # ruby 1.8.x doesn't provide hash ordering
    tests('#v2 url w/ response-cache-control').returns(
      "https://fognonbucket.s3.amazonaws.com/test.txt?response-cache-control=No-cache&AWSAccessKeyId=123&Signature=foo&Expires=#{now.to_i + 500}"
    ) do

      @file.url(now + 500, :query => { 'response-cache-control' => 'No-cache' })
    end
  end


end

Version data entries

35 entries across 35 versions & 2 rubygems

Version Path
fog-aws-1.4.1 tests/models/storage/url_tests.rb
fog-aws-1.4.0 tests/models/storage/url_tests.rb
fog-aws-1.3.0 tests/models/storage/url_tests.rb
fog-aws-1.2.1 tests/models/storage/url_tests.rb
fog-aws-1.2.0 tests/models/storage/url_tests.rb
fog-aws-1.1.0 tests/models/storage/url_tests.rb
fog-aws-1.0.0 tests/models/storage/url_tests.rb
fog-aws-0.13.0 tests/models/storage/url_tests.rb
fog-aws-0.12.0 tests/models/storage/url_tests.rb
fog-aws-0.11.0 tests/models/storage/url_tests.rb
fog-aws-0.10.0 tests/models/storage/url_tests.rb
fog-aws-0.9.4 tests/models/storage/url_tests.rb
fog-aws-0.9.3 tests/models/storage/url_tests.rb
fog-aws-0.9.2 tests/models/storage/url_tests.rb
fog-aws-0.9.1 tests/models/storage/url_tests.rb
fog-aws-0.9.0 tests/models/storage/url_tests.rb
fog-aws-0.8.1 tests/models/storage/url_tests.rb
fog-aws-0.8.0 tests/models/storage/url_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-aws-0.7.5/tests/models/storage/url_tests.rb
fog-aws-0.7.6 tests/models/storage/url_tests.rb