mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 10:34:19 +01:00
Slightly tweaked, added test.
This commit is contained in:
parent
fe9468c0e6
commit
d4442a04ff
@ -510,8 +510,10 @@ class Fun(callbacks.Privmsg):
|
|||||||
"""
|
"""
|
||||||
nick = msg.nick
|
nick = msg.nick
|
||||||
channel = msg.args[0]
|
channel = msg.args[0]
|
||||||
|
if not ircutils.isChannel(channel):
|
||||||
|
irc.error(msg, 'This message must be sent in a channel.')
|
||||||
if random.randint(1, 6) == 1:
|
if random.randint(1, 6) == 1:
|
||||||
irc.queueMsg(ircmsgs.kick(channel, nick))
|
irc.queueMsg(ircmsgs.kick(channel, nick, 'BANG!'))
|
||||||
else:
|
else:
|
||||||
irc.reply(msg, '*click*')
|
irc.reply(msg, '*click*')
|
||||||
|
|
||||||
|
@ -37,6 +37,19 @@ import utils
|
|||||||
|
|
||||||
class FunTest(ChannelPluginTestCase, PluginDocumentation):
|
class FunTest(ChannelPluginTestCase, PluginDocumentation):
|
||||||
plugins = ('Fun',)
|
plugins = ('Fun',)
|
||||||
|
def testRoulette(self):
|
||||||
|
sawKick = False
|
||||||
|
for i in xrange(100):
|
||||||
|
m = self.getMsg('roulette')
|
||||||
|
if m.command == 'PRIVMSG':
|
||||||
|
self.failUnless('click' in m.args[1].lower())
|
||||||
|
elif m.command == 'KICK':
|
||||||
|
sawKick = True
|
||||||
|
self.failUnless('bang' in m.args[2].lower())
|
||||||
|
else:
|
||||||
|
self.fail('Got something other than a kick or a privmsg.')
|
||||||
|
self.failUnless(sawKick, 'Didn\'t get a kick in %s iterations!' % i)
|
||||||
|
|
||||||
def testNoErrors(self):
|
def testNoErrors(self):
|
||||||
self.assertNotError('leet foobar')
|
self.assertNotError('leet foobar')
|
||||||
self.assertNotError('lithp meghan sweeney')
|
self.assertNotError('lithp meghan sweeney')
|
||||||
|
Loading…
Reference in New Issue
Block a user