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.notice = notice or self.notice
self.private = private or self.private self.private = private or self.private
self.to = to or self.to self.to = to or self.to
self.prefixName = prefixName or self.prefixName self.prefixName = prefixName and self.prefixName
self.noLengthCheck = noLengthCheck or self.noLengthCheck self.noLengthCheck = noLengthCheck or self.noLengthCheck
if self.finalEvaled: if self.finalEvaled:
if isinstance(self.irc, self.__class__): if isinstance(self.irc, self.__class__):

View File

@ -219,14 +219,29 @@ class PrivmsgTestCase(ChannelPluginTestCase):
self.assertResponse("eval irc.reply('foo', action=True)", self.assertResponse("eval irc.reply('foo', action=True)",
'\x01ACTION foo\x01') '\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): def testErrorPrivateKwarg(self):
try: try:
original = str(conf.supybot.reply.errorInPrivate) original = conf.supybot.reply.errorInPrivate()
conf.supybot.reply.errorInPrivate.set('False') conf.supybot.reply.errorInPrivate.set('False')
m = self.getMsg("eval irc.error('foo', private=True)") m = self.getMsg("eval irc.error('foo', private=True)")
self.failIf(ircutils.isChannel(m.args[0])) self.failIf(ircutils.isChannel(m.args[0]))
finally: finally:
conf.supybot.reply.errorInPrivate.set(original) conf.supybot.reply.errorInPrivate.setValue(original)
def testErrorReplyPrivate(self): def testErrorReplyPrivate(self):
try: try:

View File

@ -306,6 +306,10 @@ class ChannelPluginTestCase(PluginTestCase):
return return
PluginTestCase.setUp(self) PluginTestCase.setUp(self)
self.irc.feedMsg(ircmsgs.join(self.channel, prefix=self.prefix)) 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): def _feedMsg(self, query, timeout=None, to=None, frm=None):
if to is None: if to is None: