From faa27d573ff554ac95c017a2bfc557ae54b933d6 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 18 Feb 2004 07:36:40 +0000 Subject: [PATCH] Fix for bug #899271, as well as some other problems with the test suite and ChannelPluginTestCase. --- src/callbacks.py | 2 +- test/test_callbacks.py | 19 +++++++++++++++++-- test/testsupport.py | 4 ++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/callbacks.py b/src/callbacks.py index 66c554c98..6a63e4dcd 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -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__): diff --git a/test/test_callbacks.py b/test/test_callbacks.py index dd5f399c2..b12a23bea 100644 --- a/test/test_callbacks.py +++ b/test/test_callbacks.py @@ -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: diff --git a/test/testsupport.py b/test/testsupport.py index 39f574f86..32e83521c 100644 --- a/test/testsupport.py +++ b/test/testsupport.py @@ -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: