From 28048e319fe6eab007173c05a196afd2f7895b72 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Sat, 25 Jan 2020 21:01:48 -0500 Subject: [PATCH] add a regression test for oragono #754 --- irctest/server_tests/test_regressions.py | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/irctest/server_tests/test_regressions.py b/irctest/server_tests/test_regressions.py index ebb420a..df1fbb5 100644 --- a/irctest/server_tests/test_regressions.py +++ b/irctest/server_tests/test_regressions.py @@ -48,3 +48,32 @@ class RegressionsTestCase(cases.BaseServerTestCase): self.sendLine(1, 'NICK Alice') ms = self.getMessages(2) self.assertEqual(ms, []) + + @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') + def testTagCap(self): + # regression test for oragono #754 + self.connectClient('alice', capabilities=['message-tags', 'batch', 'echo-message', 'server-time']) + self.connectClient('bob') + self.getMessages(1) + self.getMessages(2) + + self.sendLine(1, '@+draft/reply=ct95w3xemz8qj9du2h74wp8pee PRIVMSG bob :hey yourself') + ms = self.getMessages(1) + self.assertEqual(len(ms), 1) + self.assertMessageEqual(ms[0], command='PRIVMSG', params=['bob', 'hey yourself']) + self.assertEqual(ms[0].tags.get('+draft/reply'), 'ct95w3xemz8qj9du2h74wp8pee') + + ms = self.getMessages(2) + self.assertEqual(len(ms), 1) + self.assertMessageEqual(ms[0], command='PRIVMSG', params=['bob', 'hey yourself']) + self.assertEqual(ms[0].tags, {}) + + self.sendLine(2, 'CAP REQ :message-tags server-time') + self.getMessages(2) + self.sendLine(1, '@+draft/reply=tbxqauh9nykrtpa3n6icd9whan PRIVMSG bob :hey again') + self.getMessages(1) + ms = self.getMessages(2) + # now bob has the tags cap, so he should receive the tags + self.assertEqual(len(ms), 1) + self.assertMessageEqual(ms[0], command='PRIVMSG', params=['bob', 'hey again']) + self.assertEqual(ms[0].tags.get('+draft/reply'), 'tbxqauh9nykrtpa3n6icd9whan')