File: test_google_application_default_credentials.rb

package info (click to toggle)
ruby-kubeclient 4.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,112 kB
  • sloc: ruby: 4,225; makefile: 6
file content (17 lines) | stat: -rw-r--r-- 506 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

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