test incorrect channel keys (#169)

This commit is contained in:
Shivaram Lingamneni 2022-05-29 00:49:21 -07:00 committed by GitHub
parent 683f7c0a15
commit 058fab85b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,10 +27,16 @@ class KeyTestCase(cases.BaseServerTestCase):
self.connectClient("qux")
self.getMessages(2)
# JOIN with a missing key MUST receive ERR_BADCHANNELKEY:
self.sendLine(2, "JOIN #chan")
reply = self.getMessages(2)
self.assertNotIn("JOIN", {msg.command for msg in reply})
self.assertIn(ERR_BADCHANNELKEY, {msg.command for msg in reply})
reply_cmds = {msg.command for msg in self.getMessages(2)}
self.assertNotIn("JOIN", reply_cmds)
self.assertIn(ERR_BADCHANNELKEY, reply_cmds)
# similarly for JOIN with an incorrect key:
self.sendLine(2, "JOIN #chan bees")
reply_cmds = {msg.command for msg in self.getMessages(2)}
self.assertNotIn("JOIN", reply_cmds)
self.assertIn(ERR_BADCHANNELKEY, reply_cmds)
self.sendLine(2, "JOIN #chan beer")
reply = self.getMessages(2)