Fixed a failing test, showed a results number in search, and added to our standardSubstitute for Dunnos.

This commit is contained in:
Jeremy Fincher 2004-11-08 17:02:02 +00:00
parent eed842270d
commit 6341b26755
3 changed files with 11 additions and 6 deletions

View File

@ -78,7 +78,8 @@ class Dunno(plugins.ChannelIdDatabasePlugin):
if dunno is not None: if dunno is not None:
dunno = dunno.text dunno = dunno.text
prefixName = self.registryValue('prefixNick', channel) prefixName = self.registryValue('prefixNick', channel)
dunno = ircutils.standardSubstitute(irc, msg, dunno) env = {'command': tokens[0]}
dunno = ircutils.standardSubstitute(irc, msg, dunno, env=env)
irc.reply(dunno, prefixName=prefixName) irc.reply(dunno, prefixName=prefixName)

View File

@ -460,7 +460,7 @@ class ChannelIdDatabasePlugin(callbacks.Privmsg):
L.append(self.searchSerializeRecord(record)) L.append(self.searchSerializeRecord(record))
if L: if L:
L.sort() L.sort()
irc.reply(utils.commaAndify(L)) irc.reply('%s found: %s' % (len(L), utils.commaAndify(L)))
else: else:
irc.reply('No matching %s were found.' % irc.reply('No matching %s were found.' %
utils.pluralize(self.name().lower())) utils.pluralize(self.name().lower()))

View File

@ -46,14 +46,14 @@ class DunnoTestCase(ChannelPluginTestCase, PluginDocumentation):
def testDunnoSearch(self): def testDunnoSearch(self):
self.assertNotError('dunno add foo') self.assertNotError('dunno add foo')
self.assertRegexp('dunno search moo', 'No dunnos found') self.assertRegexp('dunno search moo', 'No.*dunnos.*found')
self.assertNotError('dunno add moo') self.assertNotError('dunno add moo')
self.assertRegexp('dunno search moo', r'\(1 found\)') self.assertRegexp('dunno search moo', r'1 found')
self.assertRegexp('dunno search m', r'\(1 found\)') self.assertRegexp('dunno search m', r'1 found')
# Test multiple adds # Test multiple adds
for i in range(5): for i in range(5):
self.assertNotError('dunno add moo%s' % i) self.assertNotError('dunno add moo%s' % i)
self.assertRegexp('dunno search moo', r'\(6 found\)') self.assertRegexp('dunno search moo', r'6 found')
def testDunnoGet(self): def testDunnoGet(self):
self.assertNotError('dunno add moo') self.assertNotError('dunno add moo')
@ -67,3 +67,7 @@ class DunnoTestCase(ChannelPluginTestCase, PluginDocumentation):
self.assertNotError('dunno add moo') self.assertNotError('dunno add moo')
self.assertNotError('dunno change 1 s/moo/bar/') self.assertNotError('dunno change 1 s/moo/bar/')
self.assertRegexp('dunno get 1', '.*?: \'bar\'') self.assertRegexp('dunno get 1', '.*?: \'bar\'')
def testDollarCommand(self):
self.assertNotError("dunno add I can't $command.")
self.assertResponse('asdf', "I can't asdf.")