Misc: Add tests for “list --unloaded” and command flood.

This commit is contained in:
Valentin Lorentz 2014-01-21 13:21:28 +01:00
parent 74a36c8cfc
commit b026cfd197

View File

@ -98,6 +98,7 @@ class MiscTestCase(ChannelPluginTestCase):
def testList(self): def testList(self):
self.assertNotError('list') self.assertNotError('list')
self.assertNotError('list Misc') self.assertNotError('list Misc')
self.assertRegexp('list --unloaded', 'Ctcp')
def testListIsCaseInsensitive(self): def testListIsCaseInsensitive(self):
self.assertNotError('list misc') self.assertNotError('list misc')
@ -227,6 +228,13 @@ class MiscTestCase(ChannelPluginTestCase):
def testInvalidCommand(self): def testInvalidCommand(self):
self.assertError('echo []') self.assertError('echo []')
def testInvalidCommands(self):
with conf.supybot.abuse.flood.command.invalid.maximum.context(3):
self.assertNotRegexp('foo', 'given me', frm='f!f@__no_testcap__')
self.assertNotRegexp('bar', 'given me', frm='f!f@__no_testcap__')
self.assertNotRegexp('baz', 'given me', frm='f!f@__no_testcap__')
self.assertRegexp('qux', 'given me', frm='f!f@__no_testcap__')
def testMoreIsCaseInsensitive(self): def testMoreIsCaseInsensitive(self):
self.assertNotError('echo %s' % ('abc'*2000)) self.assertNotError('echo %s' % ('abc'*2000))
self.assertNotError('more') self.assertNotError('more')