From 7c2bbeb638ad9b87bb22f4dfeac0c89091c7a233 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 25 Feb 2005 10:00:42 +0000 Subject: [PATCH] Forgot the tests for source-nested plugins. --- test/test_callbacks.py | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/test/test_callbacks.py b/test/test_callbacks.py index 6fe851d80..bab1aa55b 100644 --- a/test/test_callbacks.py +++ b/test/test_callbacks.py @@ -497,6 +497,49 @@ class RichReplyMethodsTestCase(PluginTestCase): self.assertRegexp('error', 'admin') +class SourceNestedPluginTestCase(PluginTestCase): + plugins = ('Utilities',) + class E(callbacks.Plugin): + def f(self, irc, msg, args): + """takes no arguments + + F + """ + irc.reply('f') + + class g(callbacks.Commands): + def h(self, irc, msg, args): + """takes no arguments + + H + """ + irc.reply('h') + + class i(callbacks.Commands): + def j(self, irc, msg, args): + """takes no arguments + + J + """ + irc.reply('j') + + def test(self): + cb = self.E(self.irc) + self.irc.addCallback(cb) + self.assertEqual(cb.getCommand(['f']), ['f']) + self.assertEqual(cb.getCommand(['e', 'f']), ['e', 'f']) + self.assertEqual(cb.getCommand(['e', 'g', 'h']), ['e', 'g', 'h']) + self.assertEqual(cb.getCommand(['e', 'g', 'i', 'j']), + ['e', 'g', 'i', 'j']) + self.assertResponse('e f', 'f') + self.assertResponse('e g h', 'h') + self.assertResponse('e g i j', 'j') + self.assertHelp('help f') + self.assertHelp('help e g h') + self.assertHelp('help e g i j') + self.assertRegexp('list e', 'f, g h, and g i j') + + class WithPrivateNoticeTestCase(ChannelPluginTestCase): plugins = ('Utilities',) class WithPrivateNotice(callbacks.Plugin):