Updated to consider getting the help string an error in assertNotError and assertError.

This commit is contained in:
Jeremy Fincher 2003-10-24 11:31:48 +00:00
parent af402fd60a
commit f8da745d3f

View File

@ -61,6 +61,14 @@ import ircutils
import callbacks
import Owner
originalCallbacksGetHelp = callbacks.getHelp
lastGetHelp = 'x'*1000
def cachingGetHelp(method, name=None):
global lastGetHelp
lastGetHelp = originalCallbacksGetHelp(method, name)
return lastGetHelp
callbacks.getHelp = cachingGetHelp
nicks = ['fatjim','scn','moshez','LordVan','MetaCosm','pythong','fishfart',
'alb','d0rt','jemfinch','StyxAlso','fors','deltab','gd',
'hellz_hunter','are_j|pub_comp','jason_','dreid','sayke_','winjer',
@ -186,6 +194,7 @@ class PluginTestCase(unittest.TestCase):
m = self._feedMsg(query)
if m is None:
raise TimeoutError, query
if lastGetHelp not in m.args[1]:
self.failUnless(m.args[1].startswith('Error:'),
'%r did not error: %s' % (query, m.args[1]))
@ -195,6 +204,8 @@ class PluginTestCase(unittest.TestCase):
raise TimeoutError, query
self.failIf(m.args[1].startswith('Error:'),
'%r errored: %s' % (query, m.args[1]))
self.failIf(lastGetHelp in m.args[1],
'%r returned the help string.' % query)
def assertNoResponse(self, query, timeout=None):
m = self._feedMsg(query, timeout)
@ -408,5 +419,6 @@ if __name__ == '__main__':
runner.run(suite)
print 'Total asserts: %s' % unittest.asserts
world.testing = False
debug._close()
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: