Sha256: 1c4090391a6f83719b059ab9192fc793cf6e13693e75115f55dd32d023c2217b

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

require_relative '../test_helper'

module Datacentred
  class AuthorizationIntegrationTest < Minitest::Test
    def test_account_not_authorized
      VCR.use_cassette "not_authorized" do
        assert_raises Errors::Unauthorized do
          Datacentred::Project.all
        end
      end
    end

    def test_manually_setting_credentials
      Datacentred.access_key = "foo"
      assert_equal "foo", Datacentred.access_key
      Datacentred.secret_key = "bar"
      assert_equal "bar", Datacentred.secret_key
    end

    def test_catch_all_error
      # VCR edited to return HTTP 418
      VCR.use_cassette "unexpected_error" do
        error = assert_raises Datacentred::Errors::Error do
          Datacentred::Project.all
        end
        assert_equal "Error 418: Im a teapot.", error.message
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datacentred-1.1.1 test/integration/authorization_test.rb