Adding config to init file and indentation fixes
This commit is contained in:
parent
e92495f0d1
commit
c6e8194127
@ -15,4 +15,4 @@
|
||||
from .config_exception import ConfigException
|
||||
from .incluster_config import load_incluster_config
|
||||
from .kube_config import (list_kube_config_contexts, load_kube_config,
|
||||
new_client_from_config)
|
||||
new_client_from_config, load_kube_config_from_dict)
|
||||
|
||||
@ -33,11 +33,10 @@ from .kube_config import (ENV_KUBECONFIG_PATH_SEPARATOR, CommandTokenSource,
|
||||
ConfigNode, FileOrData, KubeConfigLoader,
|
||||
KubeConfigMerger, _cleanup_temp_files,
|
||||
_create_temp_file_with_content,
|
||||
_get_kube_config_loader_for_yaml_file,
|
||||
_get_kube_config_loader,
|
||||
_get_kube_config_loader_for_yaml_file,
|
||||
list_kube_config_contexts, load_kube_config,
|
||||
load_kube_config_from_dict,
|
||||
new_client_from_config)
|
||||
load_kube_config_from_dict, new_client_from_config)
|
||||
|
||||
BEARER_TOKEN_FORMAT = "Bearer %s"
|
||||
|
||||
@ -1237,8 +1236,8 @@ class TestKubeConfigLoader(BaseTestCase):
|
||||
|
||||
actual = FakeConfig()
|
||||
load_kube_config_from_dict(config_dict=self.TEST_KUBE_CONFIG,
|
||||
context="simple_token",
|
||||
client_configuration=actual)
|
||||
context="simple_token",
|
||||
client_configuration=actual)
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_list_kube_config_contexts(self):
|
||||
@ -1370,26 +1369,26 @@ class TestKubeConfigLoader(BaseTestCase):
|
||||
config_file = self._create_temp_file(
|
||||
yaml.safe_dump(self.TEST_KUBE_CONFIG))
|
||||
actual = _get_kube_config_loader(filename=config_file,
|
||||
persist_config=True)
|
||||
persist_config=True)
|
||||
self.assertTrue(callable(actual._config_persister))
|
||||
self.assertEquals(actual._config_persister.__name__, "save_changes")
|
||||
|
||||
def test__get_kube_config_loader_dict_no_persist(self):
|
||||
expected = FakeConfig(host=TEST_HOST,
|
||||
token=BEARER_TOKEN_FORMAT % TEST_DATA_BASE64)
|
||||
actual = _get_kube_config_loader_for_yaml_file(config_dict=self.TEST_KUBE_CONFIG)
|
||||
actual = _get_kube_config_loader_for_yaml_file(
|
||||
config_dict=self.TEST_KUBE_CONFIG)
|
||||
self.assertIsNone(actual._config_persister)
|
||||
|
||||
def test__get_kube_config_loader_dict_persist(self):
|
||||
expected = FakeConfig(host=TEST_HOST,
|
||||
token=BEARER_TOKEN_FORMAT % TEST_DATA_BASE64)
|
||||
actual = _get_kube_config_loader(config_dict=self.TEST_KUBE_CONFIG,
|
||||
persist_config=True)
|
||||
persist_config=True)
|
||||
self.assertTrue(callable(actual._config_persister))
|
||||
self.assertEquals(actual._config_persister.__name__, "save_changes")
|
||||
|
||||
|
||||
|
||||
class TestKubernetesClientConfiguration(BaseTestCase):
|
||||
# Verifies properties of kubernetes.client.Configuration.
|
||||
# These tests guard against changes to the upstream configuration class,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user