From f19079c75ec363b6f76f9856b70782edd2c23617 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 11 Apr 2020 16:06:00 +0200 Subject: [PATCH] Misc: rewrite @more tests to fully check the output. This uncovered a few bugs; next commits will fix them. --- plugins/Misc/test.py | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/plugins/Misc/test.py b/plugins/Misc/test.py index 9532ed355..a31a000bf 100644 --- a/plugins/Misc/test.py +++ b/plugins/Misc/test.py @@ -209,21 +209,30 @@ class MiscTestCase(ChannelPluginTestCase): nickConfig.setValue(orig) def testMore(self): - self.assertRegexp('echo %s' % ('abc'*400), 'more') - self.assertRegexp('more', 'more') - self.assertNotRegexp('more', 'more') + self.assertResponse('echo %s' % ('abc '*400), + 'abc '*112 + ' \x02(3 more messages)\x02') + self.assertResponse('more', + 'abc '*112 + ' \x02(2 more messages)\x0f') + self.assertResponse('more', + 'abc '*112 + ' \x02(1 more message)\x0f') + self.assertResponse('more', + ' '.join(['abc']*(400-112*3))) + self.assertResponse('more', + "Error: That's all, there is no more.") + + def testMoreMores(self): with conf.supybot.plugins.Misc.mores.context(2): - self.assertRegexp('echo %s' % ('abc'*700), 'more') - - self.assertNotRegexp('more', 'more') + self.assertResponse('echo %s' % ('abc '*400), + 'abc '*112 + ' \x02(3 more messages)\x02') + self.assertResponse('more', + 'abc '*112) m = self.irc.takeMsg() self.assertIsNot(m, None) - self.assertIn('more', m.args[1]) - - self.assertNotRegexp('more', 'more') - m = self.irc.takeMsg() - self.assertIsNot(m, None) - self.assertNotIn('more', m.args[1]) + self.assertEqual( + m.args[1], + self.nick + ': ' + 'abc '*112 + ' \x02(1 more message)\x0f') + self.assertResponse('more', + "Error: That's all, there is no more.") def testClearMores(self): self.assertRegexp('echo %s' % ('abc'*700), 'more')