Ejemplo n.º 1
0
class PluginBaseTestCase(TestCase):

    def setUp(self):
        self.plugin = PluginBase()

    def test_plugin_decline(self):
        self.assertEquals(self.plugin.declined(), None)

    def test_plugin_deny(self):
        self.assertRaises(DenyError, self.plugin.deny)

    def test_plugin_deny_disconnect(self):
        self.assertRaises(DenyDisconnectError, self.plugin.deny, disconnect=True)

    def test_plugin_denysoft(self):
        self.assertRaises(DenySoftError, self.plugin.deny_soft)

    def test_plugin_denysoft_disconnect(self):
        self.assertRaises(DenySoftDisconnectError, self.plugin.deny_soft, disconnect=True)

    def test_plugin_done(self):
        self.assertRaises(DoneError, self.plugin.done)

    def test_plugin_ok(self):
        self.assertRaises(OkayError, self.plugin.ok)

    def test_plugin_vsmtpd(self):
        self.assertEqual(self.plugin.vsmtpd, None)

    def test_plugin_simple_config(self):
        self.assertEqual(list(self.plugin.simple_config('rbldns')),
            list(load_simple_config('rbldns')))

    def test_plugin_config(self):
        plugin_cfg = self.plugin.config('test', {'test': {'test1': 1}})
        config = load_config('test', {'test': {'test1': 1}})

        self.assertEqual(plugin_cfg.has_section('test'),
            config.has_section('test'))
        self.assertEqual(plugin_cfg.has_section('missing'),
            config.has_section('missing'))
        self.assertEqual(plugin_cfg.get('test', 'test1'),
            config.get('test', 'test1'))
Ejemplo n.º 2
0
 def setUp(self):
     self.plugin = PluginBase()