Sha256: 32182608e7cc5a33b4c1d1e8aca9b8f1fcc5e31612d9018a1a6d47df1ccbf2c1

Contents?: true

Size: 1014 Bytes

Versions: 7

Compression:

Stored size: 1014 Bytes

Contents

require 'test_helper'
require 'aws/api'
require 'aws/call_types/action_param'
require 'aws/signing/version3'

describe AWS::Signing::Version3 do

  class SigningV3TestAPI < AWS::API
    endpoint "aptest"
    version "2011-01-01"
    use_https true

    include AWS::CallTypes::ActionParam
    include AWS::Signing::Version3
  end

  it "signs the given request according to Version 3 rules" do
    AWS::Connection.any_instance.expects(:call).with do |request|
      params = request.params
      params.wont_be_nil

      header = request.headers["X-Amzn-Authorization"]
      parts = header.split(", ")

      parts[0].must_equal "AWS3-HTTPS AWSAccessKeyId=key"
      parts[1].must_equal "Algorithm=HmacSHA256"
      parts[2].must_match /Signature=.*/

      params["Version"].must_equal "2011-01-01"
      params["AWSAccessKeyId"].must_equal "key"

      Time.parse(params["Timestamp"]).wont_be_nil
      true
    end.returns

    obj = SigningV3TestAPI.new "key", "secret"
    obj.describe_instances
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
simple_aws-1.0.0 test/aws/signing/version3.rb
simple_aws-1.0.0.pre3 test/aws/signing/version3.rb
simple_aws-1.0.0.pre2 test/aws/signing/version3.rb
simple_aws-1.0.0.pre1 test/aws/signing/version3.rb
simple_aws-0.0.1d test/aws/signing/version3.rb
simple_aws-0.0.1c test/aws/signing/version3.rb
simple_aws-0.0.1b test/aws/signing/version3.rb