Better error reporting in assertAction.

This commit is contained in:
Jeremy Fincher 2004-08-11 06:13:11 +00:00
parent ab29dbb479
commit 77ce14f481

View File

@ -299,9 +299,10 @@ class PluginTestCase(SupyTestCase):
m = self._feedMsg(query, **kwargs)
if m is None:
raise TimeoutError, query
self.failUnless(ircmsgs.isAction(m))
self.failUnless(ircmsgs.isAction(m), '%r is not an action.' % m)
if expectedResponse is not None:
self.assertEqual(ircmsgs.unAction(m), expectedResponse)
s = ircmsgs.unAction(m)
self.assertEqual(s, expectedResponse, '%r != %r' % (s, m))
return m
def assertSnarfAction(self, query, expectedResponse=None, **kwargs):
@ -354,9 +355,12 @@ class ChannelPluginTestCase(PluginTestCase):
self.failIf(m is None, 'No message back from joining channel.')
self.assertEqual(m.command, 'WHO')
def _feedMsg(self, query, timeout=None, to=None, frm=None,
def _feedMsg(self, query, timeout=None, to=None, frm=None, private=False,
usePrefixChar=True):
if to is None:
if private:
to = self.irc.nick
else:
to = self.channel
if frm is None:
frm = self.prefix
@ -395,9 +399,12 @@ class ChannelPluginTestCase(PluginTestCase):
print 'Returning: %r' % ret
return ret
def feedMsg(self, query, to=None, frm=None):
def feedMsg(self, query, to=None, frm=None, private=False):
"""Just feeds it a message, that's all."""
if to is None:
if private:
to = self.irc.nick
else:
to = self.channel
if frm is None:
frm = self.prefix