From 04d0c8000fde21584fcd4f05d8b794352fff28a5 Mon Sep 17 00:00:00 2001 From: Val Lorentz Date: Sat, 16 Sep 2023 22:56:13 +0200 Subject: [PATCH] Test TOPIC is echoed on change (#230) * Test TOPIC is echoed on change * black --- irctest/server_tests/topic.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/irctest/server_tests/topic.py b/irctest/server_tests/topic.py index 94895715..d001fe68 100644 --- a/irctest/server_tests/topic.py +++ b/irctest/server_tests/topic.py @@ -11,13 +11,29 @@ class TopicTestCase(cases.BaseServerTestCase): @cases.mark_specifications("RFC1459", "RFC2812") - def testTopic(self): + def testTopicRfc(self): """“Once a user has joined a channel, he receives information about all commands his server receives affecting the channel. This includes […] TOPIC” -- and """ + self._testTopic(assert_echo=False) + + @cases.mark_specifications("Modern") + def testTopicModern(self): + """ "If the topic of a channel is changed or cleared, every client in that + channel (including the author of the topic change) will receive a TOPIC command + with the new topic as argument (or an empty argument if the topic was cleared) + alerting them to how the topic has changed. + + Clients joining the channel in the future will receive a RPL_TOPIC numeric (or + lack thereof) accordingly." + -- https://modern.ircdocs.horse/#topic-message + """ + self._testTopic(assert_echo=True) + + def _testTopic(self, assert_echo: bool): self.connectClient("foo") self.joinChannel(1, "#chan") @@ -41,6 +57,7 @@ def testTopic(self): ) self.assertMessageMatch(m, command="TOPIC") except client_mock.NoMessageException: + self.assertFalse(assert_echo, "TOPIC was not echoed back to the author") # The RFCs do not say TOPIC must be echoed pass m = self.getMessage(2)