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