mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Added a test to make sure JOINs happen before WHOs, and changed code to make that the case.
This commit is contained in:
parent
f1a9b3f546
commit
7e80782452
@ -122,7 +122,7 @@ class IrcMsgQueue(object):
|
|||||||
self.msgs.add(msg)
|
self.msgs.add(msg)
|
||||||
if msg.command in ('MODE', 'KICK', 'PONG'):
|
if msg.command in ('MODE', 'KICK', 'PONG'):
|
||||||
self.highpriority.enqueue(msg)
|
self.highpriority.enqueue(msg)
|
||||||
elif msg.command in ('PING',):
|
elif msg.command in ('PING', 'WHO'):
|
||||||
self.lowpriority.enqueue(msg)
|
self.lowpriority.enqueue(msg)
|
||||||
else:
|
else:
|
||||||
self.normal.enqueue(msg)
|
self.normal.enqueue(msg)
|
||||||
|
@ -46,6 +46,8 @@ class IrcMsgQueueTestCase(unittest.TestCase):
|
|||||||
pong = ircmsgs.pong('123')
|
pong = ircmsgs.pong('123')
|
||||||
ping = ircmsgs.ping('123')
|
ping = ircmsgs.ping('123')
|
||||||
notice = ircmsgs.notice('jemfinch', 'supybot here')
|
notice = ircmsgs.notice('jemfinch', 'supybot here')
|
||||||
|
join = ircmsgs.join('#foo')
|
||||||
|
who = ircmsgs.who('#foo')
|
||||||
|
|
||||||
def testEmpty(self):
|
def testEmpty(self):
|
||||||
q = irclib.IrcMsgQueue()
|
q = irclib.IrcMsgQueue()
|
||||||
@ -97,6 +99,17 @@ class IrcMsgQueueTestCase(unittest.TestCase):
|
|||||||
self.assertEqual(self.msg, q.dequeue())
|
self.assertEqual(self.msg, q.dequeue())
|
||||||
self.failIf(q)
|
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):
|
class ChannelTestCase(unittest.TestCase):
|
||||||
def testPickleCopy(self):
|
def testPickleCopy(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user