Better fix for the bugs induced by this new firewall thing.

This commit is contained in:
Jeremy Fincher 2004-08-26 05:05:01 +00:00
parent 6381e2aef8
commit e1aa6efdff
3 changed files with 20 additions and 9 deletions

View File

@ -36,6 +36,7 @@ import supybot.ircdb as ircdb
class NoteTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Note', 'Misc', 'User')
config = {'supybot.reply.whenNotCommand': False}
def setUp(self):
PluginTestCase.setUp(self)
# setup a user

View File

@ -33,14 +33,7 @@ from testsupport import *
class RootWarnerTestCase(PluginTestCase):
plugins = ('RootWarner',)
def setUp(self):
PluginTestCase.setUp(self)
self.original = conf.supybot.reply.whenNotCommand()
conf.supybot.reply.whenNotCommand.setValue(False)
def tearDown(self):
PluginTestCase.tearDown(self)
conf.supybot.reply.whenNotCommand.setValue(self.original)
config = {'supybot.reply.whenNotCommand': False}
def test(self):
self.irc.feedMsg(ircmsgs.join('#foo', prefix='foo!root@host'))

View File

@ -51,6 +51,7 @@ world.startedAt = started
import supybot.irclib as irclib
import supybot.drivers as drivers
import supybot.ircmsgs as ircmsgs
import supybot.registry as registry
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
@ -122,6 +123,11 @@ class PluginTestCase(SupyTestCase):
plugins = None
cleanConfDir = True
cleanDataDir = True
config = {}
def __init__(self, *args, **kwargs):
SupyTestCase.__init__(self, *args, **kwargs)
self.originals = {}
def setUp(self, nick='test'):
if self.__class__ in (PluginTestCase, ChannelPluginTestCase):
# Necessary because there's a test in here that shouldn\'t run.
@ -173,11 +179,22 @@ class PluginTestCase(SupyTestCase):
except Owner.Deprecated, e:
return utils.exnToString(e)
cb = Owner.loadPluginClass(self.irc, module)
for (name, value) in self.config.iteritems():
group = conf.supybot
parts = registry.split(name)
if parts[0] == 'supybot':
parts.pop(0)
for part in parts:
group = group.get(part)
self.originals[group] = group()
group.setValue(value)
def tearDown(self):
if self.__class__ in (PluginTestCase, ChannelPluginTestCase):
# Necessary because there's a test in here that shouldn\'t run.
return
for (group, original) in self.originals.iteritems():
group.setValue(original)
ircdb.users.close()
ircdb.ignores.close()
ircdb.channels.close()