mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Made Owner complain if there is more than one src/ plugin with a given command.
This commit is contained in:
parent
4b94ebe146
commit
8580b6a44e
@ -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:
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user