mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-17 06:00:42 +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:
|
except ValueError:
|
||||||
irc.error('Invalid seconds: %r' % seconds)
|
irc.error('Invalid seconds: %r' % seconds)
|
||||||
return
|
return
|
||||||
|
try:
|
||||||
|
name = int(name)
|
||||||
|
irc.error('Names must not be an integer.')
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
self.events[name] = command
|
self.events[name] = command
|
||||||
f = self._makeCommandFunction(irc, msg, command)
|
f = self._makeCommandFunction(irc, msg, command)
|
||||||
id = schedule.addPeriodicEvent(f, seconds, name)
|
id = schedule.addPeriodicEvent(f, seconds, name)
|
||||||
|
@ -31,8 +31,14 @@
|
|||||||
|
|
||||||
from testsupport import *
|
from testsupport import *
|
||||||
|
|
||||||
class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
|
import schedule
|
||||||
|
|
||||||
|
class SchedulerTestCase(ChannelPluginTestCase):
|
||||||
plugins = ('Scheduler', 'Utilities')
|
plugins = ('Scheduler', 'Utilities')
|
||||||
|
def tearDown(self):
|
||||||
|
schedule.schedule.reset()
|
||||||
|
ChannelPluginTestCase.tearDown(self)
|
||||||
|
|
||||||
def testAddRemove(self):
|
def testAddRemove(self):
|
||||||
self.assertRegexp('scheduler list', 'no.*commands')
|
self.assertRegexp('scheduler list', 'no.*commands')
|
||||||
m = self.assertNotError('scheduler add [seconds 5s] echo foo bar baz')
|
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.assertNotError('scheduler remove foo')
|
||||||
self.assertNoResponse(' ', 5)
|
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:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user