Add testReplyInstant

I'm going to mess with instant replies to add support for multiline,
so it's good to have a safety net.
This commit is contained in:
Valentin Lorentz 2021-03-05 21:11:37 +01:00
parent 4aca6e3d5a
commit f98542e884

View File

@ -534,6 +534,35 @@ class PrivmsgTestCase(ChannelPluginTestCase):
self.assertRegexp('help first firstcmd', 'First', 0) # no re.I flag. self.assertRegexp('help first firstcmd', 'First', 0) # no re.I flag.
self.assertRegexp('help firstrepeat firstcmd', 'FirstRepeat', 0) self.assertRegexp('help firstrepeat firstcmd', 'FirstRepeat', 0)
def testReplyInstant(self):
self.assertNoResponse(' ')
print(conf.supybot.reply.mores.instant())
self.assertResponse(
"eval 'foo '*300",
"'" + "foo " * 110 + " \x02(2 more messages)\x02")
self.assertNoResponse(' ')
with conf.supybot.reply.mores.instant.context(2):
self.assertResponse(
"eval 'foo '*300",
"'" + "foo " * 110 + " \x02(2 more messages)\x02")
self.assertResponse(
" ",
"foo " * 111 + "\x02(1 more message)\x02")
self.assertNoResponse(" ")
with conf.supybot.reply.mores.instant.context(3):
self.assertResponse(
"eval 'foo '*300",
"'" + "foo " * 110 + " \x02(2 more messages)\x02")
self.assertResponse(
" ",
"foo " * 111 + "\x02(1 more message)\x02")
self.assertResponse(
" ",
" " + "foo " * 79 + "'")
self.assertNoResponse(" ")
def testClientTagReply(self): def testClientTagReply(self):
self.irc.addCallback(self.First(self.irc)) self.irc.addCallback(self.First(self.irc))