Added a test to make sure JOINs happen before WHOs, and changed code to make that the case.

This commit is contained in:
Jeremy Fincher 2003-09-05 18:16:51 +00:00
parent f1a9b3f546
commit 7e80782452
2 changed files with 14 additions and 1 deletions

View File

@ -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)

View File

@ -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):