1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
Description: tests: fix Mocha 3+ strict keyword-argument matching in auth provider tests
With Mocha >= 3.0 (and Ruby 3+) strict_keyword_argument_matching defaults
to true. The real code in GcpCommandCredentials.token and
OIDCAuthProvider.token receives a *positional Hash* argument, while the
test expectations used bare `key => value` syntax inside .with().
Author: Simon Quigley <tsimonq2@debian.org>
Origin: vendor
Last-Update: 2026-02-22
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/test/test_config.rb
+++ b/test/test_config.rb
@@ -191,12 +191,14 @@ class KubeclientConfigTest < Minitest::T
def test_gcp_command_auth
Kubeclient::GCPCommandCredentials.expects(:token)
- .with('access-token' => '<fake_token>',
- 'cmd-args' => 'config config-helper --format=json',
- 'cmd-path' => '/path/to/gcloud',
- 'expiry' => '2019-04-09 19:26:18 UTC',
- 'expiry-key' => '{.credential.token_expiry}',
- 'token-key' => '{.credential.access_token}')
+ .with({
+ 'access-token' => '<fake_token>',
+ 'cmd-args' => 'config config-helper --format=json',
+ 'cmd-path' => '/path/to/gcloud',
+ 'expiry' => Time.utc(2019, 4, 9, 19, 26, 18),
+ 'expiry-key' => '{.credential.token_expiry}',
+ 'token-key' => '{.credential.access_token}'
+ })
.returns('token1')
.once
config = Kubeclient::Config.read(config_file('gcpcmdauth.kubeconfig'))
@@ -205,11 +207,13 @@ class KubeclientConfigTest < Minitest::T
def test_oidc_auth_provider
Kubeclient::OIDCAuthProvider.expects(:token)
- .with('client-id' => 'fake-client-id',
- 'client-secret' => 'fake-client-secret',
- 'id-token' => 'fake-id-token',
- 'idp-issuer-url' => 'https://accounts.google.com',
- 'refresh-token' => 'fake-refresh-token')
+ .with({
+ 'client-id' => 'fake-client-id',
+ 'client-secret' => 'fake-client-secret',
+ 'id-token' => 'fake-id-token',
+ 'idp-issuer-url' => 'https://accounts.google.com',
+ 'refresh-token' => 'fake-refresh-token'
+ })
.returns('token1')
.once
parsed = YAML.safe_load(File.read(config_file('oidcauth.kubeconfig')))
|