summaryrefslogtreecommitdiff
path: root/vendor/gems/kubeclient/test/test_google_application_default_credentials.rb
blob: 238ae729c16b146ad06b4dc716af40b0ebca5573 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require_relative 'test_helper'
require 'googleauth'

# Unit tests for the ApplicationDefaultCredentials token provider
class GoogleApplicationDefaultCredentialsTest < MiniTest::Test
  def test_token
    auth = Minitest::Mock.new
    auth.expect(:apply, nil, [{}])
    auth.expect(:access_token, 'valid_token')

    Google::Auth.stub(:get_application_default, auth) do
      assert_equal('valid_token', Kubeclient::GoogleApplicationDefaultCredentials.token)
    end
  end
end