Example #1
0
 def test_default_value_for_nonexistent_key(self):
     cfg = Config(TestConfig.section)
     default = 'default'
     value = cfg.get(TestConfig.nonexistent, default)
     self.assertIs(default, value)
Example #2
0
 def test_no_default_value_for_existent_key(self):
     cfg = Config(TestConfig.section)
     value = cfg.get(TestConfig.key, TestConfig.nonexistent)
     self.assertEqual(TestConfig.value, value)
Example #3
0
 def test_nonexistent_key(self):
     cfg = Config(TestConfig.section)
     self.assertIsNone(cfg.get(TestConfig.nonexistent))
Example #4
0
 def test_nonexistent_section(self):
     cfg = Config(TestConfig.nonexistent)
     self.assertIsNone(cfg.get('test'))
Example #5
0
 def test_default_ini_if_user_file_does_not_exist(self):
     with patch.object(Config, 'user_ini', TestConfig.nonexistent):
         cfg = Config(TestConfig.section)
     self.assertIsNotNone(cfg.get(TestConfig.key))
Example #6
0
 def __init__(self):
     cfg = Config('cloudstack')
     super().__init__(cfg.get('url'), cfg.get('key'), cfg.get('secret'))
     self._logger = ExpyLogger.getLogger('cloudstack.api')