Sha256: d6a2d663b044366dc40f70fb525dc1a8af0d1ceafaa7c0d04b591b0ae9aa79df

Contents?: true

Size: 733 Bytes

Versions: 4

Compression:

Stored size: 733 Bytes

Contents

require_relative "test_helper"

class KloudlessTest < Minitest::Test
  def test_unauthorized
    assert_raises Kloudless::ForbiddenError do
      Kloudless::Account.list
    end
  end

  def test_authorize_api_key
    Kloudless.authorize(api_key: "API_KEY")
    Kloudless.http.mock_response(Struct.new(:body).new('{}')) do
      Kloudless::Account.list
      assert_equal "ApiKey API_KEY", Kloudless::HTTP.last_request["Authorization"]
    end
  end

  def test_authorize_bearer_token
    Kloudless.authorize(token: "BEARER_TOKEN")
    Kloudless.http.mock_response(Struct.new(:body).new('{}')) do
      Kloudless::Account.list
      assert_equal "Bearer BEARER_TOKEN", Kloudless::HTTP.last_request["Authorization"]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kloudless-1.0.1 test/kloudless_test.rb
kloudless-1.0.0 test/kloudless_test.rb
kloudless-0.2.1 test/kloudless_test.rb
kloudless-0.2.0 test/kloudless_test.rb