@@ -369,7 +369,6 @@ 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
373372 self .api_key ['BearerToken' ] = token
374373
375374 self .__dict__ .update (kwargs )
@@ -906,7 +905,7 @@ def test_gcp_no_refresh(self):
906905 self .assertIsNotNone (fake_config .refresh_api_key_hook )
907906 self .assertEqual (TEST_HOST , fake_config .host )
908907 self .assertEqual (BEARER_TOKEN_FORMAT % TEST_DATA_BASE64 ,
909- fake_config .api_key ['authorization ' ])
908+ fake_config .api_key ['BearerToken ' ])
910909
911910 def test_load_gcp_token_no_refresh (self ):
912911 loader = KubeConfigLoader (
@@ -1284,14 +1283,14 @@ def test_new_client_from_config(self):
12841283 config_file = config_file , context = "simple_token" )
12851284 self .assertEqual (TEST_HOST , client .configuration .host )
12861285 self .assertEqual (BEARER_TOKEN_FORMAT % TEST_DATA_BASE64 ,
1287- client .configuration .api_key ['authorization ' ])
1286+ client .configuration .api_key ['BearerToken ' ])
12881287
12891288 def test_new_client_from_config_dict (self ):
12901289 client = new_client_from_config_dict (
12911290 config_dict = self .TEST_KUBE_CONFIG , context = "simple_token" )
12921291 self .assertEqual (TEST_HOST , client .configuration .host )
12931292 self .assertEqual (BEARER_TOKEN_FORMAT % TEST_DATA_BASE64 ,
1294- client .configuration .api_key ['authorization ' ])
1293+ client .configuration .api_key ['BearerToken ' ])
12951294
12961295 def test_no_users_section (self ):
12971296 expected = FakeConfig (host = TEST_HOST )
@@ -1318,7 +1317,6 @@ def test_user_exec_auth(self, mock):
13181317 "token" : token
13191318 }
13201319 expected = FakeConfig (host = TEST_HOST , api_key = {
1321- "authorization" : BEARER_TOKEN_FORMAT % token ,
13221320 "BearerToken" : BEARER_TOKEN_FORMAT % token })
13231321 actual = FakeConfig ()
13241322 KubeConfigLoader (
@@ -1349,13 +1347,13 @@ def test_user_exec_auth_with_expiry(self, mock):
13491347 active_context = "exec_cred_user" ).load_and_set (fake_config )
13501348 # The kube config should use the first token returned from the
13511349 # exec provider.
1352- self .assertEqual (fake_config .api_key ["authorization " ],
1350+ self .assertEqual (fake_config .api_key ["BearerToken " ],
13531351 BEARER_TOKEN_FORMAT % expired_token )
13541352 # Should now be populated with a method to refresh expired tokens.
13551353 self .assertIsNotNone (fake_config .refresh_api_key_hook )
13561354 # Refresh the token; the kube config should be updated.
13571355 fake_config .refresh_api_key_hook (fake_config )
1358- self .assertEqual (fake_config .api_key ["authorization " ],
1356+ self .assertEqual (fake_config .api_key ["BearerToken " ],
13591357 BEARER_TOKEN_FORMAT % current_token )
13601358
13611359 @mock .patch ('kubernetes.config.kube_config.ExecProvider.run' )
@@ -1397,7 +1395,6 @@ def test_user_cmd_path(self):
13971395 return_value = A (token , parse_rfc3339 (datetime .datetime .now ()))
13981396 CommandTokenSource .token = mock .Mock (return_value = return_value )
13991397 expected = FakeConfig (api_key = {
1400- "authorization" : BEARER_TOKEN_FORMAT % token ,
14011398 "BearerToken" : BEARER_TOKEN_FORMAT % token })
14021399 actual = FakeConfig ()
14031400 KubeConfigLoader (
@@ -1411,7 +1408,6 @@ def test_user_cmd_path_empty(self):
14111408 return_value = A (token , parse_rfc3339 (datetime .datetime .now ()))
14121409 CommandTokenSource .token = mock .Mock (return_value = return_value )
14131410 expected = FakeConfig (api_key = {
1414- "authorization" : BEARER_TOKEN_FORMAT % token ,
14151411 "BearerToken" : BEARER_TOKEN_FORMAT % token })
14161412 actual = FakeConfig ()
14171413 self .expect_exception (lambda : KubeConfigLoader (
@@ -1426,7 +1422,6 @@ def test_user_cmd_path_with_scope(self):
14261422 return_value = A (token , parse_rfc3339 (datetime .datetime .now ()))
14271423 CommandTokenSource .token = mock .Mock (return_value = return_value )
14281424 expected = FakeConfig (api_key = {
1429- "authorization" : BEARER_TOKEN_FORMAT % token ,
14301425 "BearerToken" : BEARER_TOKEN_FORMAT % token })
14311426 actual = FakeConfig ()
14321427 self .expect_exception (lambda : KubeConfigLoader (
@@ -1728,7 +1723,7 @@ def test_new_client_from_config(self):
17281723 config_file = kubeconfigs , context = "simple_token" )
17291724 self .assertEqual (TEST_HOST , client .configuration .host )
17301725 self .assertEqual (BEARER_TOKEN_FORMAT % TEST_DATA_BASE64 ,
1731- client .configuration .api_key ['authorization ' ])
1726+ client .configuration .api_key ['BearerToken ' ])
17321727
17331728 def test_merge_with_context_in_different_file (self ):
17341729 kubeconfigs = self ._create_multi_config (self .TEST_KUBE_CONFIG_SET2 )
@@ -1744,7 +1739,7 @@ def test_merge_with_context_in_different_file(self):
17441739 self .assertEqual (active_context , expected_contexts [0 ])
17451740 self .assertEqual (TEST_HOST , client .configuration .host )
17461741 self .assertEqual (BEARER_TOKEN_FORMAT % TEST_DATA_BASE64 ,
1747- client .configuration .api_key ['authorization ' ])
1742+ client .configuration .api_key ['BearerToken ' ])
17481743
17491744 def test_save_changes (self ):
17501745 kubeconfigs = self ._create_multi_config (self .TEST_KUBE_CONFIG_SET1 )
0 commit comments