Fix for bug #899271, as well as some other problems with the test suite and ChannelPluginTestCase.

This commit is contained in:
Jeremy Fincher 2004-02-18 07:36:40 +00:00
parent dcf7d167eb
commit faa27d573f
3 changed files with 22 additions and 3 deletions

View File

@ -540,7 +540,7 @@ class IrcObjectProxy(RichReplyMethods):
self.notice = notice or self.notice
self.private = private or self.private
self.to = to or self.to
self.prefixName = prefixName or self.prefixName
self.prefixName = prefixName and self.prefixName
self.noLengthCheck = noLengthCheck or self.noLengthCheck
if self.finalEvaled:
if isinstance(self.irc, self.__class__):

View File

@ -219,14 +219,29 @@ class PrivmsgTestCase(ChannelPluginTestCase):
self.assertResponse("eval irc.reply('foo', action=True)",
'\x01ACTION foo\x01')
def testReplyWithNickPrefix(self):
self.feedMsg('@strlen foo')
m = self.irc.takeMsg()
self.failUnless(m is not None, 'm: %r' % m)
self.failUnless(m.args[1].startswith(self.nick))
try:
original = conf.supybot.reply.withNickPrefix()
conf.supybot.reply.withNickPrefix.setValue(False)
self.feedMsg('@strlen foobar')
m = self.irc.takeMsg()
self.failUnless(m is not None)
self.failIf(m.args[1].startswith(self.nick))
finally:
conf.supybot.reply.withNickPrefix.setValue(original)
def testErrorPrivateKwarg(self):
try:
original = str(conf.supybot.reply.errorInPrivate)
original = conf.supybot.reply.errorInPrivate()
conf.supybot.reply.errorInPrivate.set('False')
m = self.getMsg("eval irc.error('foo', private=True)")
self.failIf(ircutils.isChannel(m.args[0]))
finally:
conf.supybot.reply.errorInPrivate.set(original)
conf.supybot.reply.errorInPrivate.setValue(original)
def testErrorReplyPrivate(self):
try:

View File

@ -306,6 +306,10 @@ class ChannelPluginTestCase(PluginTestCase):
return
PluginTestCase.setUp(self)
self.irc.feedMsg(ircmsgs.join(self.channel, prefix=self.prefix))
m = self.irc.takeMsg()
self.assertEqual(m.command, 'MODE')
m = self.irc.takeMsg()
self.assertEqual(m.command, 'WHO')
def _feedMsg(self, query, timeout=None, to=None, frm=None):
if to is None: