@@ -369,7 +369,7 @@ def __init__(self, token=None, **kwargs):
369369 # Provided by the OpenAPI-generated Configuration class
370370 self .refresh_api_key_hook = None
371371 if token :
372- self .api_key ['authorization ' ] = token
372+ self .api_key ['BearerToken ' ] = token
373373
374374 self .__dict__ .update (kwargs )
375375
@@ -905,7 +905,7 @@ def test_gcp_no_refresh(self):
905905 self .assertIsNotNone (fake_config .refresh_api_key_hook )
906906 self .assertEqual (TEST_HOST , fake_config .host )
907907 self .assertEqual (BEARER_TOKEN_FORMAT % TEST_DATA_BASE64 ,
908- fake_config .api_key ['authorization ' ])
908+ fake_config .api_key ['BearerToken ' ])
909909
910910 def test_load_gcp_token_no_refresh (self ):
911911 loader = KubeConfigLoader (
@@ -1283,14 +1283,14 @@ def test_new_client_from_config(self):
12831283 config_file = config_file , context = "simple_token" )
12841284 self .assertEqual (TEST_HOST , client .configuration .host )
12851285 self .assertEqual (BEARER_TOKEN_FORMAT % TEST_DATA_BASE64 ,
1286- client .configuration .api_key ['authorization ' ])
1286+ client .configuration .api_key ['BearerToken ' ])
12871287
12881288 def test_new_client_from_config_dict (self ):
12891289 client = new_client_from_config_dict (
12901290 config_dict = self .TEST_KUBE_CONFIG , context = "simple_token" )
12911291 self .assertEqual (TEST_HOST , client .configuration .host )
12921292 self .assertEqual (BEARER_TOKEN_FORMAT % TEST_DATA_BASE64 ,
1293- client .configuration .api_key ['authorization ' ])
1293+ client .configuration .api_key ['BearerToken ' ])
12941294
12951295 def test_no_users_section (self ):
12961296 expected = FakeConfig (host = TEST_HOST )
@@ -1317,7 +1317,7 @@ def test_user_exec_auth(self, mock):
13171317 "token" : token
13181318 }
13191319 expected = FakeConfig (host = TEST_HOST , api_key = {
1320- "authorization " : BEARER_TOKEN_FORMAT % token })
1320+ "BearerToken " : BEARER_TOKEN_FORMAT % token })
13211321 actual = FakeConfig ()
13221322 KubeConfigLoader (
13231323 config_dict = self .TEST_KUBE_CONFIG ,
@@ -1347,13 +1347,13 @@ def test_user_exec_auth_with_expiry(self, mock):
13471347 active_context = "exec_cred_user" ).load_and_set (fake_config )
13481348 # The kube config should use the first token returned from the
13491349 # exec provider.
1350- self .assertEqual (fake_config .api_key ["authorization " ],
1350+ self .assertEqual (fake_config .api_key ["BearerToken " ],
13511351 BEARER_TOKEN_FORMAT % expired_token )
13521352 # Should now be populated with a method to refresh expired tokens.
13531353 self .assertIsNotNone (fake_config .refresh_api_key_hook )
13541354 # Refresh the token; the kube config should be updated.
13551355 fake_config .refresh_api_key_hook (fake_config )
1356- self .assertEqual (fake_config .api_key ["authorization " ],
1356+ self .assertEqual (fake_config .api_key ["BearerToken " ],
13571357 BEARER_TOKEN_FORMAT % current_token )
13581358
13591359 @mock .patch ('kubernetes.config.kube_config.ExecProvider.run' )
@@ -1395,7 +1395,7 @@ def test_user_cmd_path(self):
13951395 return_value = A (token , parse_rfc3339 (datetime .datetime .now ()))
13961396 CommandTokenSource .token = mock .Mock (return_value = return_value )
13971397 expected = FakeConfig (api_key = {
1398- "authorization " : BEARER_TOKEN_FORMAT % token })
1398+ "BearerToken " : BEARER_TOKEN_FORMAT % token })
13991399 actual = FakeConfig ()
14001400 KubeConfigLoader (
14011401 config_dict = self .TEST_KUBE_CONFIG ,
@@ -1408,7 +1408,7 @@ def test_user_cmd_path_empty(self):
14081408 return_value = A (token , parse_rfc3339 (datetime .datetime .now ()))
14091409 CommandTokenSource .token = mock .Mock (return_value = return_value )
14101410 expected = FakeConfig (api_key = {
1411- "authorization " : BEARER_TOKEN_FORMAT % token })
1411+ "BearerToken " : BEARER_TOKEN_FORMAT % token })
14121412 actual = FakeConfig ()
14131413 self .expect_exception (lambda : KubeConfigLoader (
14141414 config_dict = self .TEST_KUBE_CONFIG ,
@@ -1422,7 +1422,7 @@ def test_user_cmd_path_with_scope(self):
14221422 return_value = A (token , parse_rfc3339 (datetime .datetime .now ()))
14231423 CommandTokenSource .token = mock .Mock (return_value = return_value )
14241424 expected = FakeConfig (api_key = {
1425- "authorization " : BEARER_TOKEN_FORMAT % token })
1425+ "BearerToken " : BEARER_TOKEN_FORMAT % token })
14261426 actual = FakeConfig ()
14271427 self .expect_exception (lambda : KubeConfigLoader (
14281428 config_dict = self .TEST_KUBE_CONFIG ,
@@ -1723,7 +1723,7 @@ def test_new_client_from_config(self):
17231723 config_file = kubeconfigs , context = "simple_token" )
17241724 self .assertEqual (TEST_HOST , client .configuration .host )
17251725 self .assertEqual (BEARER_TOKEN_FORMAT % TEST_DATA_BASE64 ,
1726- client .configuration .api_key ['authorization ' ])
1726+ client .configuration .api_key ['BearerToken ' ])
17271727
17281728 def test_merge_with_context_in_different_file (self ):
17291729 kubeconfigs = self ._create_multi_config (self .TEST_KUBE_CONFIG_SET2 )
@@ -1739,7 +1739,7 @@ def test_merge_with_context_in_different_file(self):
17391739 self .assertEqual (active_context , expected_contexts [0 ])
17401740 self .assertEqual (TEST_HOST , client .configuration .host )
17411741 self .assertEqual (BEARER_TOKEN_FORMAT % TEST_DATA_BASE64 ,
1742- client .configuration .api_key ['authorization ' ])
1742+ client .configuration .api_key ['BearerToken ' ])
17431743
17441744 def test_save_changes (self ):
17451745 kubeconfigs = self ._create_multi_config (self .TEST_KUBE_CONFIG_SET1 )
0 commit comments