From 7e80782452b3aca754f0c37e08e12f387b8a9aab Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 5 Sep 2003 18:16:51 +0000 Subject: [PATCH] Added a test to make sure JOINs happen before WHOs, and changed code to make that the case. --- src/irclib.py | 2 +- test/test_irclib.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/irclib.py b/src/irclib.py index f2af6445f..18a5f47e4 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -122,7 +122,7 @@ class IrcMsgQueue(object): self.msgs.add(msg) if msg.command in ('MODE', 'KICK', 'PONG'): self.highpriority.enqueue(msg) - elif msg.command in ('PING',): + elif msg.command in ('PING', 'WHO'): self.lowpriority.enqueue(msg) else: self.normal.enqueue(msg) diff --git a/test/test_irclib.py b/test/test_irclib.py index 6bacc8f0c..b7e49a8f8 100644 --- a/test/test_irclib.py +++ b/test/test_irclib.py @@ -46,6 +46,8 @@ class IrcMsgQueueTestCase(unittest.TestCase): pong = ircmsgs.pong('123') ping = ircmsgs.ping('123') notice = ircmsgs.notice('jemfinch', 'supybot here') + join = ircmsgs.join('#foo') + who = ircmsgs.who('#foo') def testEmpty(self): q = irclib.IrcMsgQueue() @@ -97,6 +99,17 @@ class IrcMsgQueueTestCase(unittest.TestCase): self.assertEqual(self.msg, q.dequeue()) self.failIf(q) + def testJoinBeforeWho(self): + q = irclib.IrcMsgQueue() + q.enqueue(self.join) + q.enqueue(self.who) + self.assertEqual(self.join, q.dequeue()) + self.assertEqual(self.who, q.dequeue()) + q.enqueue(self.who) + q.enqueue(self.join) + self.assertEqual(self.join, q.dequeue()) + self.assertEqual(self.who, q.dequeue()) + class ChannelTestCase(unittest.TestCase): def testPickleCopy(self):