diff --git a/irctest/server_tests/monitor.py b/irctest/server_tests/monitor.py index 9305d37..7c2ad70 100644 --- a/irctest/server_tests/monitor.py +++ b/irctest/server_tests/monitor.py @@ -249,6 +249,23 @@ class MonitorTestCase(_BaseMonitorTestCase): extra_format=(messages,), ) + @cases.mark_specifications("IRCv3") + @cases.mark_isupport("MONITOR") + def testMonitorClear(self): + """“Clears the list of targets being monitored. No output will be returned + for use of this command.“ + -- + """ + self.connectClient("foo") + self.check_server_support() + self.sendLine(1, "MONITOR + bar") + self.getMessages(1) + + self.sendLine(1, "MONITOR C") + self.sendLine(1, "MONITOR L") + m = self.getMessage(1) + self.assertEqual(m.command, RPL_ENDOFMONLIST) + @cases.mark_specifications("IRCv3") @cases.mark_isupport("MONITOR") def testMonitorList(self): @@ -284,6 +301,35 @@ class MonitorTestCase(_BaseMonitorTestCase): self.sendLine(1, "MONITOR L") checkMonitorSubjects(self.getMessages(1), "bar", {"bazbat"}) + @cases.mark_specifications("IRCv3") + @cases.mark_isupport("MONITOR") + def testMonitorStatus(self): + """“Outputs for each target in the list being monitored, whether + the client is online or offline. All targets that are online will + be sent using RPL_MONONLINE, all targets that are offline will be + sent using RPL_MONOFFLINE.“ + -- + """ + self.connectClient("foo") + self.check_server_support() + self.connectClient("bar") + self.sendLine(1, "MONITOR + bar,baz") + self.getMessages(1) + + self.sendLine(1, "MONITOR S") + msgs = self.getMessages(1) + self.assertEqual( + len(msgs), + 2, + fail_msg="Expected one RPL_MONONLINE (730) and one RPL_MONOFFLINE (731), got: {}", + extra_format=(msgs,), + ) + + msgs.sort(key=lambda m: m.command) + + self.assertMononline(1, "bar", m=msgs[0]) + self.assertMonoffline(1, "baz", m=msgs[1]) + @cases.mark_specifications("IRCv3") @cases.mark_isupport("MONITOR") def testNickChange(self):