Skip to content
This repository has been archived by the owner on Mar 13, 2022. It is now read-only.

Commit

Permalink
Adding test Cases
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnu667 committed May 15, 2020
1 parent 27a1b81 commit 3ed1f12
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions config/kube_config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,39 @@ def test__get_kube_config_loader_for_yaml_file_persist(self):
self.assertTrue(callable(actual._config_persister))
self.assertEquals(actual._config_persister.__name__, "save_changes")

def test__get_kube_config_loader_file_no_persist(self):
expected = FakeConfig(host=TEST_HOST,
token=BEARER_TOKEN_FORMAT % TEST_DATA_BASE64)
config_file = self._create_temp_file(
yaml.safe_dump(self.TEST_KUBE_CONFIG))
actual = _get_kube_config_loader(filename=config_file)
self.assertIsNone(actual._config_persister)

def test__get_kube_config_loader_file_persist(self):
expected = FakeConfig(host=TEST_HOST,
token=BEARER_TOKEN_FORMAT % TEST_DATA_BASE64)
config_file = self._create_temp_file(
yaml.safe_dump(self.TEST_KUBE_CONFIG))
actual = _get_kube_config_loader(filename=config_file,
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)
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)
self.assertTrue(callable(actual._config_persister))
self.assertEquals(actual._config_persister.__name__, "save_changes")



class TestKubernetesClientConfiguration(BaseTestCase):
# Verifies properties of kubernetes.client.Configuration.
Expand Down

0 comments on commit 3ed1f12

Please sign in to comment.