mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Better error reporting in assertAction.
This commit is contained in:
parent
ab29dbb479
commit
77ce14f481
@ -299,9 +299,10 @@ class PluginTestCase(SupyTestCase):
|
|||||||
m = self._feedMsg(query, **kwargs)
|
m = self._feedMsg(query, **kwargs)
|
||||||
if m is None:
|
if m is None:
|
||||||
raise TimeoutError, query
|
raise TimeoutError, query
|
||||||
self.failUnless(ircmsgs.isAction(m))
|
self.failUnless(ircmsgs.isAction(m), '%r is not an action.' % m)
|
||||||
if expectedResponse is not None:
|
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
|
return m
|
||||||
|
|
||||||
def assertSnarfAction(self, query, expectedResponse=None, **kwargs):
|
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.failIf(m is None, 'No message back from joining channel.')
|
||||||
self.assertEqual(m.command, 'WHO')
|
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):
|
usePrefixChar=True):
|
||||||
if to is None:
|
if to is None:
|
||||||
|
if private:
|
||||||
|
to = self.irc.nick
|
||||||
|
else:
|
||||||
to = self.channel
|
to = self.channel
|
||||||
if frm is None:
|
if frm is None:
|
||||||
frm = self.prefix
|
frm = self.prefix
|
||||||
@ -395,9 +399,12 @@ class ChannelPluginTestCase(PluginTestCase):
|
|||||||
print 'Returning: %r' % ret
|
print 'Returning: %r' % ret
|
||||||
return 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."""
|
"""Just feeds it a message, that's all."""
|
||||||
if to is None:
|
if to is None:
|
||||||
|
if private:
|
||||||
|
to = self.irc.nick
|
||||||
|
else:
|
||||||
to = self.channel
|
to = self.channel
|
||||||
if frm is None:
|
if frm is None:
|
||||||
frm = self.prefix
|
frm = self.prefix
|
||||||
|
Loading…
Reference in New Issue
Block a user