Sha256: af1c1e3e3694a7aeff369cd5524d97164970ed7d6233378f71ebd1b625c3166c

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

require 'test_helper'

class Docusigner::BaseTest < Test::Unit::TestCase

  context "headers" do
    teardown do
      Docusigner::Base.instance_variable_set(:@headers, nil)
      Docusigner::Account.instance_variable_set(:@headers, nil)
    end

    should "be inheritable" do
      Docusigner::Base.headers['X-Foo'] = "bar"
      assert_equal('bar', Docusigner::Account.headers['X-Foo'])

      Docusigner::Account.headers["X-Bar"] = "foo"
      assert_nil(Docusigner::Base.headers["X-Bar"])
    end

    should "authenticate via a bearer token" do
      Docusigner::Base.token = "sometoken"
      assert_equal("Bearer sometoken", Docusigner::Base.headers['Authorization'])
    end

    should "authenticate via username, password, integrator_key" do
      Docusigner::Base.authorization = {
        :username => "Jeff",
        :password => "supersecure",
        :integrator_key => "longkey",
      }
      assert_equal("<DocuSignCredentials><Username>Jeff</Username><Password>supersecure</Password><IntegratorKey>longkey</IntegratorKey></DocuSignCredentials>", 
        Docusigner::Base.headers['X-DocuSign-Authentication'])
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
docusigner-0.0.9 test/unit/base_test.rb
docusigner-0.0.8 test/unit/base_test.rb
docusigner-0.0.6 test/unit/base_test.rb
docusigner-0.0.5 test/unit/base_test.rb
docusigner-0.0.4 test/unit/base_test.rb
docusigner-0.0.3 test/unit/base_test.rb
docusigner-0.0.2 test/unit/base_test.rb
docusigner-0.0.1 test/unit/base_test.rb