From 058fab85b0967ed0f7011d1b161a5ad0a702b441 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Sun, 29 May 2022 00:49:21 -0700 Subject: [PATCH] test incorrect channel keys (#169) --- irctest/server_tests/chmodes/key.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/irctest/server_tests/chmodes/key.py b/irctest/server_tests/chmodes/key.py index 1f8773a..fd4c008 100644 --- a/irctest/server_tests/chmodes/key.py +++ b/irctest/server_tests/chmodes/key.py @@ -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)