mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
Better fix for the bugs induced by this new firewall thing.
This commit is contained in:
parent
6381e2aef8
commit
e1aa6efdff
@ -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
|
||||
|
@ -33,15 +33,8 @@ 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'))
|
||||
self.assertNotError(' ')
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user