From de49571b1e66104b3dff8033a0333404f4be7a45 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Mon, 8 Feb 2021 17:47:11 -0500 Subject: [PATCH] add test coverage for RPL_TOPIC --- irctest/server_tests/test_channel_operations.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/irctest/server_tests/test_channel_operations.py b/irctest/server_tests/test_channel_operations.py index d37e7a3..eb372b2 100644 --- a/irctest/server_tests/test_channel_operations.py +++ b/irctest/server_tests/test_channel_operations.py @@ -7,7 +7,7 @@ from irctest import cases from irctest import client_mock from irctest import runner from irctest.irc_utils import ambiguities -from irctest.numerics import RPL_NOTOPIC, RPL_NAMREPLY, RPL_INVITING +from irctest.numerics import RPL_TOPIC, RPL_TOPICTIME, RPL_NOTOPIC, RPL_NAMREPLY, RPL_INVITING from irctest.numerics import ERR_NOSUCHCHANNEL, ERR_NOTONCHANNEL, ERR_CHANOPRIVSNEEDED, ERR_NOSUCHNICK, ERR_INVITEONLYCHAN, ERR_CANNOTSENDTOCHAN, ERR_BADCHANNELKEY, ERR_INVALIDMODEPARAM, ERR_UNKNOWNERROR MODERN_CAPS = ['server-time', 'message-tags', 'batch', 'labeled-response', 'echo-message', 'account-tag'] @@ -841,6 +841,14 @@ class TopicPrivileges(cases.BaseServerTestCase): self.assertIn(ERR_CHANOPRIVSNEEDED, replies) self.assertNotIn('TOPIC', replies) + # test that RPL_TOPIC and RPL_TOPICTIME are sent on join + self.connectClient('buzz', name='buzz') + self.sendLine('buzz', 'JOIN #chan') + replies = self.getMessages('buzz') + rpl_topic = [msg for msg in replies if msg.command == RPL_TOPIC][0] + self.assertMessageEqual(rpl_topic, command=RPL_TOPIC, params=['buzz', '#chan', 'new topic']) + self.assertEqual(len([msg for msg in replies if msg.command == RPL_TOPICTIME]), 1) + class ModeratedMode(cases.BaseServerTestCase):