Added assertHelp to remedy the fact that help strings now count as errors.

This commit is contained in:
Jeremy Fincher 2003-10-24 11:44:44 +00:00
parent f8da745d3f
commit 80777b942f
3 changed files with 11 additions and 5 deletions

View File

@ -207,6 +207,12 @@ class PluginTestCase(unittest.TestCase):
self.failIf(lastGetHelp in m.args[1],
'%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):
m = self._feedMsg(query, timeout)
self.failIf(m, 'Unexpected response: %s' % msg.args[1])

View File

@ -61,14 +61,14 @@ class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
conf.repylWhenNotCommand = False
def testHelp(self):
self.assertNotError('help list')
self.assertHelp('help list')
try:
original = conf.prefixChars
conf.prefixChars = '@'
self.assertNotError('help @list')
self.assertHelp('help @list')
finally:
conf.prefixChars = original
self.assertNotError('help list')
self.assertHelp('help list')
self.assertRegexp('help help', r'^\x02\(help')
self.assertError('help morehelp')

View File

@ -243,8 +243,8 @@ class PrivmsgTestCase(ChannelPluginTestCase):
def testHelpDispatching(self):
self.irc.addCallback(self.First())
self.assertNotError('help firstcmd')
self.assertNotError('help first firstcmd')
self.assertHelp('help firstcmd')
self.assertHelp('help first firstcmd')
self.irc.addCallback(self.FirstRepeat())
self.assertError('help firstcmd')
self.assertRegexp('help first firstcmd', 'First', 0) # no re.I flag.