Fix tests broken by 6a06ca991.

This commit is contained in:
Valentin Lorentz 2012-12-26 15:37:52 +01:00
parent 790f0eea35
commit 84148988b3
4 changed files with 13 additions and 4 deletions

View File

@ -33,6 +33,8 @@ class AdminTestCase(PluginTestCase):
plugins = ('Admin',)
def testChannels(self):
def getAfterJoinMessages():
m = self.irc.takeMsg()
self.assertEqual(m.command, 'MODE')
m = self.irc.takeMsg()
self.assertEqual(m.command, 'MODE')
m = self.irc.takeMsg()
@ -94,6 +96,8 @@ class AdminTestCase(PluginTestCase):
def testPart(self):
def getAfterJoinMessages():
m = self.irc.takeMsg()
self.assertEqual(m.command, 'MODE')
m = self.irc.takeMsg()
self.assertEqual(m.command, 'MODE')
m = self.irc.takeMsg()

View File

@ -506,10 +506,6 @@ class IrcState(IrcCommandDispatcher):
self.channels[channel] = chan
# I don't know why this assert was here.
#assert msg.nick == irc.nick, msg
if msg.nick == irc.nick:
# Ask for the ban list
for channel in msg.args[0].split(','):
irc.queueMsg(ircmsgs.mode(channel, '+b'))
def do367(self, irc, msg):
# Example:
@ -1007,6 +1003,8 @@ class Irc(IrcCommandDispatcher):
channel = msg.args[0]
self.queueMsg(ircmsgs.who(channel)) # Ends with 315.
self.queueMsg(ircmsgs.mode(channel)) # Ends with 329.
for channel in msg.args[0].split(','):
self.queueMsg(ircmsgs.mode(channel, '+b'))
self.startedSync[channel] = time.time()
def do315(self, msg):

View File

@ -241,6 +241,10 @@ def separateModes(args):
else:
requireArguments = _minusRequireArguments
if c in requireArguments:
if not args:
# It happens, for example with "MODE #channel +b", which
# is used for getting the list of all bans.
continue
arg = args.pop(0)
try:
arg = int(arg)

View File

@ -401,6 +401,9 @@ class ChannelPluginTestCase(PluginTestCase):
self.assertEqual(m.command, 'MODE')
m = self.irc.takeMsg()
self.failIf(m is None, 'No message back from joining channel.')
self.assertEqual(m.command, 'MODE')
m = self.irc.takeMsg()
self.failIf(m is None, 'No message back from joining channel.')
self.assertEqual(m.command, 'WHO')
def _feedMsg(self, query, timeout=None, to=None, frm=None, private=False,