mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-19 08:59:27 +01:00
Added assertHelp to remedy the fact that help strings now count as errors.
This commit is contained in:
parent
f8da745d3f
commit
80777b942f
@ -207,6 +207,12 @@ class PluginTestCase(unittest.TestCase):
|
|||||||
self.failIf(lastGetHelp in m.args[1],
|
self.failIf(lastGetHelp in m.args[1],
|
||||||
'%r returned the help string.' % query)
|
'%r returned the help string.' % query)
|
||||||
|
|
||||||
|
def assertHelp(self, query):
|
||||||
|
m = self._feedMsg(query)
|
||||||
|
if m is None:
|
||||||
|
raise TimeoutError, query
|
||||||
|
self.failUnless(lastGetHelp in m.args[1])
|
||||||
|
|
||||||
def assertNoResponse(self, query, timeout=None):
|
def assertNoResponse(self, query, timeout=None):
|
||||||
m = self._feedMsg(query, timeout)
|
m = self._feedMsg(query, timeout)
|
||||||
self.failIf(m, 'Unexpected response: %s' % msg.args[1])
|
self.failIf(m, 'Unexpected response: %s' % msg.args[1])
|
||||||
|
@ -61,14 +61,14 @@ class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
conf.repylWhenNotCommand = False
|
conf.repylWhenNotCommand = False
|
||||||
|
|
||||||
def testHelp(self):
|
def testHelp(self):
|
||||||
self.assertNotError('help list')
|
self.assertHelp('help list')
|
||||||
try:
|
try:
|
||||||
original = conf.prefixChars
|
original = conf.prefixChars
|
||||||
conf.prefixChars = '@'
|
conf.prefixChars = '@'
|
||||||
self.assertNotError('help @list')
|
self.assertHelp('help @list')
|
||||||
finally:
|
finally:
|
||||||
conf.prefixChars = original
|
conf.prefixChars = original
|
||||||
self.assertNotError('help list')
|
self.assertHelp('help list')
|
||||||
self.assertRegexp('help help', r'^\x02\(help')
|
self.assertRegexp('help help', r'^\x02\(help')
|
||||||
self.assertError('help morehelp')
|
self.assertError('help morehelp')
|
||||||
|
|
||||||
|
@ -243,8 +243,8 @@ class PrivmsgTestCase(ChannelPluginTestCase):
|
|||||||
|
|
||||||
def testHelpDispatching(self):
|
def testHelpDispatching(self):
|
||||||
self.irc.addCallback(self.First())
|
self.irc.addCallback(self.First())
|
||||||
self.assertNotError('help firstcmd')
|
self.assertHelp('help firstcmd')
|
||||||
self.assertNotError('help first firstcmd')
|
self.assertHelp('help first firstcmd')
|
||||||
self.irc.addCallback(self.FirstRepeat())
|
self.irc.addCallback(self.FirstRepeat())
|
||||||
self.assertError('help firstcmd')
|
self.assertError('help firstcmd')
|
||||||
self.assertRegexp('help first firstcmd', 'First', 0) # no re.I flag.
|
self.assertRegexp('help first firstcmd', 'First', 0) # no re.I flag.
|
||||||
|
Loading…
Reference in New Issue
Block a user