Beispiel #1
0
 def test_sub_sub_conf(self):
     conf = Configuration({
         'KEY': 'value',
         'SUB_KEY': 'sub value',
         'SUB_SUB_KEY': 'sub sub value'
     })
     subsubconf = conf.get_sub_conf('SUB').get_sub_conf('SUB')
     self.assertEqual(subsubconf['KEY'], 'sub sub value')
Beispiel #2
0
 def setUp(self):
     self.irc_mock = type('MockFactory', (object, ), {
         'protocol_instance': None,
         'unhandled_requests': []
     })
     self.webhook_response = 'test'
     webhook = Webhook(
         self.irc_mock,
         Configuration({'WEBHOOK_RESPONSE': self.webhook_response}))
     factory = Site(webhook)
     self.port = reactor.listenTCP(0, factory, interface="127.0.0.1")
     self.portnum = self.port.getHost().port
Beispiel #3
0
 def test_ensure_fails_chaind(self):
     conf = Configuration({'KEY': 'value', 'SUB_KEY': 'sub value'})
     subconf = conf.get_sub_conf('SUB')
     with self.assertRaisesRegexp(ImproperlyConfigured, "SUB_SUB_KEY"):
         subconf.ensure('SUB_KEY')
Beispiel #4
0
 def test_ensure_fails(self):
     conf = Configuration()
     with self.assertRaises(ImproperlyConfigured):
         conf.ensure('KEY')
Beispiel #5
0
 def test_ensure_simple(self):
     conf = Configuration({'KEY': 'value'})
     self.assertEqual(conf.ensure('KEY'), None)
Beispiel #6
0
 def test_simple_conf(self):
     conf = Configuration({'KEY': 'value', 'SUB_KEY': 'sub value'})
     self.assertEqual(conf['KEY'], 'value')
     self.assertEqual(conf['SUB_KEY'], 'sub value')