Made to load Owner by default.

This commit is contained in:
Jeremy Fincher 2003-10-21 20:47:55 +00:00
parent 86b633cfe6
commit 232c634436
6 changed files with 18 additions and 13 deletions

View File

@ -111,7 +111,7 @@ class PluginTestCase(unittest.TestCase):
for an example.
"""
timeout = 10
plugins = ()
plugins = None
cleanConfDir = True
cleanDataDir = True
def setUp(self, nick='test'):
@ -125,20 +125,23 @@ class PluginTestCase(unittest.TestCase):
debug.reset()
ircdb.users.reload()
ircdb.channels.reload()
if not self.plugins:
if self.plugins is None:
raise ValueError, 'PluginTestCase must have a "plugins" attribute.'
self.nick = nick
self.prefix = ircutils.joinHostmask(nick, 'user', 'host.domain.tld')
self.irc = irclib.Irc(nick)
while self.irc.takeMsg():
pass
_ = Owner.loadPluginClass(self.irc, Owner)
if isinstance(self.plugins, str):
module = Owner.loadPluginModule(self.plugins)
cb = Owner.loadPluginClass(self.irc, module)
if self.plugins != 'Owner':
module = Owner.loadPluginModule(self.plugins)
cb = Owner.loadPluginClass(self.irc, module)
else:
for name in self.plugins:
module = Owner.loadPluginModule(name)
cb = Owner.loadPluginClass(self.irc, module)
if name != 'Owner':
module = Owner.loadPluginModule(name)
cb = Owner.loadPluginClass(self.irc, module)
def tearDown(self):
self.irc.die()
@ -259,7 +262,6 @@ class PluginTestCase(unittest.TestCase):
class ChannelPluginTestCase(PluginTestCase):
channel = '#test'
def setUp(self):
PluginTestCase.setUp(self)
self.irc.feedMsg(ircmsgs.join(self.channel, prefix=self.prefix))

View File

@ -32,8 +32,7 @@
from test import *
class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
plugins = ('Misc', 'Owner',
'Utilities', 'Gameknot', 'Ctcp')
plugins = ('Misc', 'Utilities', 'Gameknot', 'Ctcp')
def testReplyWhenNotCommand(self):
try:
conf.replyWhenNotCommand = True

View File

@ -38,7 +38,7 @@ except ImportError:
if sqlite is not None:
class FactoidsTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Misc', 'MoobotFactoids', 'User')
plugins = ('Misc', 'MoobotFactoids', 'User', 'Utilities')
def setUp(self):
PluginTestCase.setUp(self)
# Create a valid user to use
@ -185,6 +185,10 @@ if sqlite is not None:
self.assertNotError('lock moo')
self.assertError('no moo is qux')
def testRegexpNotCalledIfAlreadyHandled(self):
self.assertResponse('echo foo is bar', 'foo is bar')
self.assertNoResponse(' ', 3)
class DunnoTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Misc', 'MoobotFactoids', 'User')
def setUp(self):

View File

@ -35,7 +35,7 @@ import conf
import Owner
class OwnerTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Owner',)
plugins = ()
def testEval(self):
try:
originalConfAllowEval = conf.allowEval

View File

@ -34,7 +34,7 @@ from test import *
import world
class StatusTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Status', 'Owner')
plugins = ('Status',)
def testBestuptime(self):
self.assertNotRegexp('bestuptime', '33 years')
self.assertNotError('unload Status')

View File

@ -163,7 +163,7 @@ class FunctionsTestCase(unittest.TestCase):
class PrivmsgTestCase(ChannelPluginTestCase):
plugins = ('Utilities', 'Owner', 'Misc')
plugins = ('Utilities', 'Misc')
conf.allowEval = True
timeout = 2
def testEmptySquareBrackets(self):