From 93a989b74638f8124bf70680051655d99c57ce88 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 7 Aug 2021 14:30:33 +0200 Subject: [PATCH] Test NAMES on invalid/nonexisting channel returns RPL_ENDOFNAMES. --- Makefile | 2 + .../server_tests/test_channel_operations.py | 47 +++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/Makefile b/Makefile index 863e58f..15e506d 100644 --- a/Makefile +++ b/Makefile @@ -33,12 +33,14 @@ HYBRID_SELECTORS := \ # testNoticeNonexistentChannel fails because of https://github.com/inspircd/inspircd/issues/1849 # testBotPrivateMessage and testBotChannelMessage fail because https://github.com/inspircd/inspircd/pull/1910 is not released yet +# testNamesInvalidChannel and testNamesNonexistingChannel fail because https://github.com/inspircd/inspircd/pull/1922 is not released yet. INSPIRCD_SELECTORS := \ not Ergo \ and not deprecated \ and not strict \ and not testNoticeNonexistentChannel \ and not testBotPrivateMessage and not testBotChannelMessage \ + and not testNamesInvalidChannel and not testNamesNonexistingChannel \ $(EXTRA_SELECTORS) MAMMON_SELECTORS := \ diff --git a/irctest/server_tests/test_channel_operations.py b/irctest/server_tests/test_channel_operations.py index 380c40b..9b0f3bf 100644 --- a/irctest/server_tests/test_channel_operations.py +++ b/irctest/server_tests/test_channel_operations.py @@ -22,6 +22,7 @@ from irctest.numerics import ( ERR_NOSUCHNICK, ERR_NOTONCHANNEL, ERR_UNKNOWNERROR, + RPL_ENDOFNAMES, RPL_INVITING, RPL_NAMREPLY, RPL_NOTOPIC, @@ -1070,6 +1071,52 @@ class AuditoriumTestCase(cases.BaseServerTestCase): ) +class NamesTestCase(cases.BaseServerTestCase): + @cases.mark_specifications("RFC1459", "RFC2812", "Modern") + def testNamesInvalidChannel(self): + """ + "There is no error reply for bad channel names." + -- https://datatracker.ietf.org/doc/html/rfc1459#section-4.2.5 + -- https://datatracker.ietf.org/doc/html/rfc2812#section-3.2.5 + + "If the channel name is invalid or the channel does not exist, + one `RPL_ENDOFNAMES` numeric containing the given channel name + should be returned." + -- https://modern.ircdocs.horse/#names-message + """ + self.connectClient("foo") + self.getMessages(1) + + self.sendLine(1, "NAMES invalid") + self.assertMessageMatch( + self.getMessage(1), + command=RPL_ENDOFNAMES, + params=["foo", "invalid", ANYSTR], + ) + + @cases.mark_specifications("RFC1459", "RFC2812", "Modern") + def testNamesNonexistingChannel(self): + """ + "There is no error reply for bad channel names." + -- https://datatracker.ietf.org/doc/html/rfc1459#section-4.2.5 + -- https://datatracker.ietf.org/doc/html/rfc2812#section-3.2.5 + + "If the channel name is invalid or the channel does not exist, + one `RPL_ENDOFNAMES` numeric containing the given channel name + should be returned." + -- https://modern.ircdocs.horse/#names-message + """ + self.connectClient("foo") + self.getMessages(1) + + self.sendLine(1, "NAMES #nonexisting") + self.assertMessageMatch( + self.getMessage(1), + command=RPL_ENDOFNAMES, + params=["foo", "#nonexisting", ANYSTR], + ) + + class TopicPrivileges(cases.BaseServerTestCase): @cases.mark_specifications("RFC2812") def testTopicPrivileges(self):