Added some try/finallies to make sure replyWhenNotCommand always got reset properly.

This commit is contained in:
Jeremy Fincher 2003-09-17 19:16:56 +00:00
parent 41339e80e7
commit 1c99146f41

View File

@ -34,24 +34,30 @@ from test import *
class MiscCommandsTestCase(ChannelPluginTestCase, PluginDocumentation): class MiscCommandsTestCase(ChannelPluginTestCase, PluginDocumentation):
plugins = ('MiscCommands', 'Utilities', 'ChannelDB') plugins = ('MiscCommands', 'Utilities', 'ChannelDB')
def testReplyWhenNotCommand(self): def testReplyWhenNotCommand(self):
try:
conf.replyWhenNotCommand = True conf.replyWhenNotCommand = True
self.prefix = 'somethingElse!user@host.domain.tld' self.prefix = 'somethingElse!user@host.domain.tld'
self.assertRegexp('foo bar baz', 'not.*command') self.assertRegexp('foo bar baz', 'not.*command')
self.assertRegexp('foo | bar | baz', 'not.*commands') self.assertRegexp('foo | bar | baz', 'not.*commands')
self.assertRegexp('baz [foo] [bar]', 'not.*commands') self.assertRegexp('baz [foo] [bar]', 'not.*commands')
finally:
conf.replyWhenNotCommand = False conf.replyWhenNotCommand = False
def testNotReplyWhenRegexpsMatch(self): def testNotReplyWhenRegexpsMatch(self):
try:
conf.replyWhenNotCommand = True conf.replyWhenNotCommand = True
self.prefix = 'somethingElse!user@host.domain.tld' self.prefix = 'somethingElse!user@host.domain.tld'
self.assertNoResponse('@coffee++', 2) self.assertNoResponse('@coffee++', 2)
finally:
conf.replyWhenNotCommand = False conf.replyWhenNotCommand = False
def testNotReplyWhenNotCanonicalName(self): def testNotReplyWhenNotCanonicalName(self):
try:
conf.replyWhenNotCommand = True conf.replyWhenNotCommand = True
self.prefix = 'somethingElse!user@host.domain.tld' self.prefix = 'somethingElse!user@host.domain.tld'
self.assertNotRegexp('STrLeN foobar', 'command') self.assertNotRegexp('STrLeN foobar', 'command')
self.assertResponse('StRlEn foobar', '6') self.assertResponse('StRlEn foobar', '6')
finally:
conf.repylWhenNotCommand = False conf.repylWhenNotCommand = False
def testHelp(self): def testHelp(self):