From 77ce14f481fb9e83ce054969b82eedadbf450259 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 11 Aug 2004 06:13:11 +0000 Subject: [PATCH] Better error reporting in assertAction. --- test/testsupport.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/test/testsupport.py b/test/testsupport.py index deaf6afe7..5d1761d4a 100644 --- a/test/testsupport.py +++ b/test/testsupport.py @@ -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,10 +355,13 @@ 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: - to = self.channel + if private: + to = self.irc.nick + else: + to = self.channel if frm is None: frm = self.prefix if timeout is None: @@ -395,10 +399,13 @@ 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: - to = self.channel + if private: + to = self.irc.nick + else: + to = self.channel if frm is None: frm = self.prefix self.irc.feedMsg(ircmsgs.privmsg(to, query, prefix=frm))