From e5789f9a3779f9c24ee56e7acae87d920ada404d Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Thu, 28 May 2020 18:39:02 -0400 Subject: [PATCH] add a test for #1076 --- irctest/server_tests/test_monitor.py | 31 +++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/irctest/server_tests/test_monitor.py b/irctest/server_tests/test_monitor.py index e42b745..9d7cf88 100644 --- a/irctest/server_tests/test_monitor.py +++ b/irctest/server_tests/test_monitor.py @@ -5,7 +5,7 @@ from irctest import cases from irctest.client_mock import NoMessageException from irctest.basecontrollers import NotImplementedByController -from irctest.numerics import RPL_MONLIST, RPL_ENDOFMONLIST +from irctest.numerics import RPL_MONLIST, RPL_ENDOFMONLIST, RPL_MONONLINE, RPL_MONOFFLINE class EchoMessageTestCase(cases.BaseServerTestCase): def check_server_support(self): @@ -255,3 +255,32 @@ class EchoMessageTestCase(cases.BaseServerTestCase): self.getMessages(1) self.sendLine(1, 'MONITOR L') checkMonitorSubjects(self.getMessages(1), 'bar', {'bazbat',}) + + + @cases.SpecificationSelector.requiredBySpecification('IRCv3.2') + def testNickChange(self): + # see oragono issue #1076: nickname changes must trigger RPL_MONOFFLINE + self.connectClient('bar') + self.check_server_support() + self.sendLine(1, 'MONITOR + qux') + self.getMessages(1) + + self.connectClient('baz') + self.getMessages(2) + self.assertEqual(self.getMessages(1), []) + + self.sendLine(2, 'NICK qux') + self.getMessages(2) + mononline = self.getMessages(1)[0] + self.assertMessageEqual(mononline, command=RPL_MONONLINE, params=['bar', 'qux']) + + # no numerics for a case change + self.sendLine(2, 'NICK QUX') + self.getMessages(2) + self.assertEqual(self.getMessages(1), []) + + self.sendLine(2, 'NICK bazbat') + self.getMessages(2) + monoffline = self.getMessages(1)[0] + # should get RPL_MONOFFLINE with the current unfolded nick + self.assertMessageEqual(monoffline, command=RPL_MONOFFLINE, params=['bar', 'QUX'])