Пример #1
0
    def __init__(self):
        self._log = logging.getLogger('pushbullet')

        token = Config('pushbullet').get('token')
        if token is None:
            msg = 'No pushbullet access token found. Check Config docs.'
            self._log.error(msg)
            raise AttributeError(msg)
        self._token = token
Пример #2
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)
Пример #3
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)
Пример #4
0
 def test_nonexistent_key(self):
     cfg = Config(TestConfig.section)
     self.assertIsNone(cfg.get(TestConfig.nonexistent))
Пример #5
0
 def test_nonexistent_section(self):
     cfg = Config(TestConfig.nonexistent)
     self.assertIsNone(cfg.get('test'))
Пример #6
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))
Пример #7
0
 def __init__(self):
     cfg = Config('cloudstack')
     super().__init__(cfg.get('url'), cfg.get('key'), cfg.get('secret'))