diff --git a/test/test.py b/test/test.py index 9b7eb1967..dd9ddfb2a 100755 --- a/test/test.py +++ b/test/test.py @@ -115,14 +115,19 @@ class PluginTestCase(unittest.TestCase): self.irc.die() gc.collect() - def _feedMsg(self, query): + def _feedMsg(self, query, timeout=None): + if timeout is None: + timeout = self.timeout self.irc.feedMsg(ircmsgs.privmsg(self.nick, query, prefix=self.prefix)) fed = time.time() response = self.irc.takeMsg() - while response is None and time.time() - fed < self.timeout: + while response is None and time.time() - fed < timeout: response = self.irc.takeMsg() return response + def getMsg(self, query, timeout=None): + return self._feedMsg(query) + def feedMsg(self, query): """Just feeds it a message, that's all.""" self.irc.feedMsg(ircmsgs.privmsg(self.nick, query, prefix=self.prefix)) @@ -143,6 +148,10 @@ class PluginTestCase(unittest.TestCase): self.failIf(m.args[1].startswith('Error:'), '%r errored: %s' % (query, m.args[1])) + def assertNoResponse(self, query, timeout=None): + m = self._feedMsg(query, timeout) + self.failIf(m) + def assertResponse(self, query, expectedResponse): m = self._feedMsg(query) self.failUnless(m)