mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Fixed problem with integer-looking ids in repeat.
This commit is contained in:
parent
af60780619
commit
2d79a470dc
@ -118,6 +118,11 @@ class Scheduler(callbacks.Privmsg):
|
||||
except ValueError:
|
||||
irc.error('Invalid seconds: %r' % seconds)
|
||||
return
|
||||
try:
|
||||
name = int(name)
|
||||
irc.error('Names must not be an integer.')
|
||||
except ValueError:
|
||||
pass
|
||||
self.events[name] = command
|
||||
f = self._makeCommandFunction(irc, msg, command)
|
||||
id = schedule.addPeriodicEvent(f, seconds, name)
|
||||
|
@ -31,8 +31,14 @@
|
||||
|
||||
from testsupport import *
|
||||
|
||||
class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
import schedule
|
||||
|
||||
class SchedulerTestCase(ChannelPluginTestCase):
|
||||
plugins = ('Scheduler', 'Utilities')
|
||||
def tearDown(self):
|
||||
schedule.schedule.reset()
|
||||
ChannelPluginTestCase.tearDown(self)
|
||||
|
||||
def testAddRemove(self):
|
||||
self.assertRegexp('scheduler list', 'no.*commands')
|
||||
m = self.assertNotError('scheduler add [seconds 5s] echo foo bar baz')
|
||||
@ -74,6 +80,9 @@ class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
self.assertNotError('scheduler remove foo')
|
||||
self.assertNoResponse(' ', 5)
|
||||
|
||||
def testRepeatDisallowsIntegerNames(self):
|
||||
self.assertError('scheduler repeat 1234 1234 "echo foo bar baz"')
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user