Made Owner complain if there is more than one src/ plugin with a given command.

This commit is contained in:
Jeremy Fincher 2003-11-09 14:01:36 +00:00
parent 4b94ebe146
commit 8580b6a44e
2 changed files with 18 additions and 16 deletions

View File

@ -97,10 +97,9 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
cbs = callbacks.findCallbackForCommand(irc, command)
if len(cbs) > 1:
names = [cb.name() for cb in cbs]
for name in names:
if name in self._srcPlugins:
tokens.insert(0, name)
break
srcs = [name for name in names if name in self._srcPlugins]
if len(srcs) == 1:
tokens.insert(0, srcs[0])
else:
ambiguousCommands[command] = names
for elt in tokens:

View File

@ -35,7 +35,7 @@ import conf
import Owner
class OwnerTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Utilities', 'Relay', 'Network')
plugins = ('Utilities', 'Relay', 'Network', 'Admin', 'Channel')
def testDefaultPlugin(self):
self.assertError('whois osu.edu')
self.assertNotError('defaultplugin whois network')
@ -57,6 +57,9 @@ class OwnerTestCase(PluginTestCase, PluginDocumentation):
finally:
conf.allowEval = originalConfAllowEval
def testSrcAmbiguity(self):
self.assertError('addcapability foo bar')
def testExec(self):
try:
originalConfAllowEval = conf.allowEval
@ -92,22 +95,22 @@ class OwnerTestCase(PluginTestCase, PluginDocumentation):
def testLoad(self):
self.assertError('load Owner')
self.assertError('load owner')
self.assertNotError('load Admin')
self.assertNotError('load Alias')
self.assertNotError('list Owner')
def testReload(self):
self.assertError('reload Admin')
self.assertNotError('load Admin')
self.assertNotError('reload Admin')
self.assertNotError('reload ADMIN')
self.assertError('reload Alias')
self.assertNotError('load Alias')
self.assertNotError('reload ALIAS')
self.assertNotError('reload ALIAS')
def testUnload(self):
self.assertError('unload Admin')
self.assertNotError('load Admin')
self.assertNotError('unload Admin')
self.assertError('unload Admin')
self.assertNotError('load ADMIN')
self.assertNotError('unload ADMIN')
self.assertError('unload Foobar')
self.assertNotError('load Alias')
self.assertNotError('unload Alias')
self.assertError('unload Alias')
self.assertNotError('load ALIAS')
self.assertNotError('unload ALIAS')
def testSetconf(self):
self.assertRegexp('setconf', 'confDir')