mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Made PluginTestCase handle multiple plugins.
This commit is contained in:
parent
0c8ee83f92
commit
09f2ae8412
@ -83,13 +83,17 @@ class PluginTestCase(unittest.TestCase):
|
|||||||
for an example.
|
for an example.
|
||||||
"""
|
"""
|
||||||
timeout = 10
|
timeout = 10
|
||||||
|
plugins = ()
|
||||||
def setUp(self, nick='test'):
|
def setUp(self, nick='test'):
|
||||||
self.nick = nick
|
self.nick = nick
|
||||||
self.prefix = ircutils.joinHostmask(nick, 'user', 'host.domain.tld')
|
self.prefix = ircutils.joinHostmask(nick, 'user', 'host.domain.tld')
|
||||||
self.irc = irclib.Irc(nick)
|
self.irc = irclib.Irc(nick)
|
||||||
while self.irc.takeMsg():
|
while self.irc.takeMsg():
|
||||||
pass
|
pass
|
||||||
self.irc.addCallback(self.plugin)
|
for name in self.plugins:
|
||||||
|
module = __import__(name)
|
||||||
|
plugin = module.Class()
|
||||||
|
self.irc.addCallback(plugin)
|
||||||
|
|
||||||
def assertResponse(self, query, expectedResponse):
|
def assertResponse(self, query, expectedResponse):
|
||||||
self.irc.feedMsg(ircmsgs.privmsg(self.nick, query, prefix=self.prefix))
|
self.irc.feedMsg(ircmsgs.privmsg(self.nick, query, prefix=self.prefix))
|
||||||
|
@ -31,10 +31,8 @@
|
|||||||
|
|
||||||
from test import *
|
from test import *
|
||||||
|
|
||||||
import FunCommands
|
|
||||||
|
|
||||||
class FunCommandsTest(PluginTestCase):
|
class FunCommandsTest(PluginTestCase):
|
||||||
plugin = FunCommands.Class()
|
plugins = ('FunCommands',)
|
||||||
def testBinary(self):
|
def testBinary(self):
|
||||||
self.assertResponse('binary A', '01000001')
|
self.assertResponse('binary A', '01000001')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user