mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-10 21:09:22 +01:00
Make sure the ban length is an integer
This commit is contained in:
parent
42ce8c33a6
commit
e485984604
@ -183,7 +183,11 @@ class Channel(callbacks.Privmsg):
|
|||||||
self.log.warning('%r tried to make me kban myself.', msg.prefix)
|
self.log.warning('%r tried to make me kban myself.', msg.prefix)
|
||||||
irc.error(msg, 'I cowardly refuse to kickban myself.')
|
irc.error(msg, 'I cowardly refuse to kickban myself.')
|
||||||
return
|
return
|
||||||
length = int(length or 0)
|
try:
|
||||||
|
length = int(length or 0)
|
||||||
|
except ValueError:
|
||||||
|
irc.error(msg, 'Ban length must be a valid integer.')
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
bannedHostmask = irc.state.nickToHostmask(bannedNick)
|
bannedHostmask = irc.state.nickToHostmask(bannedNick)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -96,6 +96,7 @@ class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
m = self.getMsg(' ')
|
m = self.getMsg(' ')
|
||||||
self.assertEqual(m, ircmsgs.kick(self.channel, 'foobar', self.nick))
|
self.assertEqual(m, ircmsgs.kick(self.channel, 'foobar', self.nick))
|
||||||
self.assertNotRegexp('kban adlkfajsdlfkjsd', 'KeyError')
|
self.assertNotRegexp('kban adlkfajsdlfkjsd', 'KeyError')
|
||||||
|
self.assertNotRegexp('kban foobar time', 'ValueError')
|
||||||
self.assertError('kban %s' % self.nick)
|
self.assertError('kban %s' % self.nick)
|
||||||
|
|
||||||
def testLobotomizers(self):
|
def testLobotomizers(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user