From b208baaa117fe2a94cac6f1f3048c67e37341d88 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Thu, 14 May 2020 12:27:38 -0400 Subject: [PATCH] add blank line test --- irctest/server_tests/test_multiline.py | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/irctest/server_tests/test_multiline.py b/irctest/server_tests/test_multiline.py index 4d54403..f0ad39e 100644 --- a/irctest/server_tests/test_multiline.py +++ b/irctest/server_tests/test_multiline.py @@ -73,3 +73,42 @@ class MultilineTestCase(cases.BaseServerTestCase, cases.OptionalityHelper): self.assertEqual(msg.tags.get('time'), time) self.assertNotIn(CONCAT_TAG, msg.tags) self.assertEqual(relayed_fmsgids, [msgid] + [None]*(len(fallback_relay)-1)) + + + @cases.SpecificationSelector.requiredBySpecification('Oragono') + def testBlankLines(self): + self.connectClient('alice', capabilities=(base_caps + [CAP_NAME])) + self.joinChannel(1, '#test') + self.connectClient('bob', capabilities=(base_caps + [CAP_NAME])) + self.joinChannel(2, '#test') + self.connectClient('charlie', capabilities=base_caps) + self.joinChannel(3, '#test') + + self.getMessages(1) + self.getMessages(2) + self.getMessages(3) + + self.sendLine(1, '@label=xyz;+client-only-tag BATCH +123 %s #test' % (BATCH_TYPE,)) + self.sendLine(1, '@batch=123 PRIVMSG #test :') + self.sendLine(1, '@batch=123 PRIVMSG #test :#how is ') + self.sendLine(1, '@batch=123;%s PRIVMSG #test :everyone?' % (CONCAT_TAG,)) + self.sendLine(1, 'BATCH -123') + self.getMessages(1) + + relay = self.getMessages(2) + batch_start = relay[0] + privmsgs = relay[1:-1] + self.assertEqual(len(privmsgs), 3) + self.assertMessageEqual(privmsgs[0], command='PRIVMSG', params=['#test', '']) + self.assertMessageEqual(privmsgs[1], command='PRIVMSG', params=['#test', '#how is ']) + self.assertMessageEqual(privmsgs[2], command='PRIVMSG', params=['#test', 'everyone?']) + self.assertIn('+client-only-tag', batch_start.tags) + msgid = batch_start.tags['msgid'] + + fallback_relay = self.getMessages(3) + self.assertEqual(len(fallback_relay), 2) + self.assertMessageEqual(fallback_relay[0], command='PRIVMSG', params=['#test', '#how is ']) + self.assertMessageEqual(fallback_relay[1], command='PRIVMSG', params=['#test', 'everyone?']) + self.assertIn('+client-only-tag', fallback_relay[0].tags) + self.assertIn('+client-only-tag', fallback_relay[1].tags) + self.assertEqual(fallback_relay[0].tags['msgid'], msgid)