def test_missing_driver(self): notifier = config.Notifier('config', 'notifier', [('foo', 'bar')]) self.assertEqual(notifier.config, 'config') self.assertEqual(notifier.default, True) self.assertEqual(notifier._driver, notifiers.PrintNotifier) self.assertEqual(notifier._driver_cache, None) self.assertEqual(notifier.additional, {'foo': 'bar'}) self.assertEqual(notifier.label, '')
def test_empty_label(self): notifier = config.Notifier('config', 'notifier:', [('driver', 'FakeNotifier'), ('foo', 'bar')]) self.assertEqual(notifier.config, 'config') self.assertEqual(notifier.default, True) self.assertEqual(notifier._driver, FakeNotifier) self.assertEqual(notifier._driver_cache, None) self.assertEqual(notifier.additional, {'foo': 'bar'}) self.assertEqual(notifier.label, '')
def test_get_driver(self): notifier = config.Notifier(None, 'notifier', [('driver', 'FakeNotifier')]) self.assertIsInstance(notifier.driver, FakeNotifier) self.assertEqual(notifier.driver.config, notifier)
def test_additional_config(self): notifier = config.Notifier(None, 'notifier', [('foo', 'bar')]) self.assertEqual(notifier['foo'], 'bar') with self.assertRaises(KeyError): _foo = notifier['bar']