Sha256: 6aedb47f8a64c021ed7b7c05a194e2d16fa17e805e0060655309f066b28e266f

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

require 'unit_test_helper'

class GenericApplicationTest < Test::Unit::TestCase
  include TestHelper

  setup do
    @headers = {"User-Agent" => "Xeroizer/2.15.5"}
    @unitdp = 4
    @options = {
      default_headers: @headers,
      unitdp: @unitdp
    }
  end

  it "fails when provided an invalid client" do
    client = "an invalid client"

    assert_raises Xeroizer::InvalidClientError do
      Xeroizer::GenericApplication.new(client, {})
    end
  end

  context "oauth" do
    setup do
      client = Xeroizer::OAuth.new(CONSUMER_KEY, CONSUMER_SECRET, @options)
      @application = Xeroizer::GenericApplication.new(client, @options)
    end

    should "pass default headers" do
      assert_equal(@headers, @application.default_headers)
    end

    should "pass unitdp value" do
      assert_equal(@unitdp, @application.unitdp)
    end
  end

  context "oauth 2" do
    setup do
      client = Xeroizer::OAuth2.new(CLIENT_ID, CLIENT_SECRET, @options)
      @application = Xeroizer::GenericApplication.new(client, @options)
    end

    should "pass default headers" do
      assert_equal(@headers, @application.default_headers)
    end

    should "pass unitdp value" do
      assert_equal(@unitdp, @application.unitdp)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xeroizer-3-pre-beta-3.0.0.pre.beta test/unit/generic_application_test.rb