diff --git a/irctest/server_tests/test_user_commands.py b/irctest/server_tests/test_user_commands.py new file mode 100644 index 0000000..c185885 --- /dev/null +++ b/irctest/server_tests/test_user_commands.py @@ -0,0 +1,35 @@ +""" +User commands as specified in Section 3.6 of RFC 2812: + +""" + +from irctest import cases + +RPL_WHOISUSER = '311' +RPL_WHOISCHANNELS = '319' + +class WhoisTestCase(cases.BaseServerTestCase): + + @cases.SpecificationSelector.requiredBySpecification('RFC2812') + def testWhoisUser(self): + """Test basic WHOIS behavior""" + nick = 'myCoolNickname' + username = 'myCoolUsername' + realname = 'My Real Name' + self.addClient() + self.sendLine(1, f'NICK {nick}') + self.sendLine(1, f'USER {username} 0 * :{realname}') + self.skipToWelcome(1) + + self.connectClient('otherNickname') + self.getMessages(2) + self.sendLine(2, 'WHOIS mycoolnickname') + messages = self.getMessages(2) + whois_user = messages[0] + self.assertEqual(whois_user.command, RPL_WHOISUSER) + # " * :" + self.assertEqual(whois_user.params[1], nick) + self.assertEqual(whois_user.params[2], '~' + username) + # dumb regression test for oragono/oragono#355: + self.assertNotIn(whois_user.params[3], [nick, username, '~' + username, realname]) + self.assertEqual(whois_user.params[5], realname)