Sha256: 937c5681dcae79c6f56c34e1bfe330265fe8f0b7c572b307a0734f6001946f06

Contents?: true

Size: 761 Bytes

Versions: 2

Compression:

Stored size: 761 Bytes

Contents

require "test_helper"
require "azure/service_bus/auth/authorizer"
require "azure/service_bus/auth/wrap"

describe Azure::ServiceBus::Auth::Authorizer do
  before do
    uri = double(path: "/path")

    @access_token = "THEACCESSTOKEN"

    @token_manager = MiniTest::Mock.new
    @token_manager.stub(:get_access_token, @access_token)

    @signer = Azure::ServiceBus::Auth::Wrap.new('issuer', 'access_key', @token_manager)

    @request = MiniTest::Mock.new
    @request.stub(:uri, uri)
    @request.stub(:headers, {})
  end

  it "generates a proper Authorization header" do
    auth = Azure::ServiceBus::Auth::Authorizer.new
    auth.sign(@request, @signer)

    @request.headers["Authorization"].must_equal "WRAP access_token=\"#{@access_token}\""
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
azure-0.1.1 test/unit/service_bus/auth/authorizer_test.rb
azure-0.1.0 test/unit/service_bus/auth/authorizer_test.rb