2003-10-13 23:22:16 +02:00
|
|
|
#!/usr/bin/env python
|
2004-02-13 11:07:43 +01:00
|
|
|
# -*- encoding: utf-8 -*-
|
2003-10-13 23:22:16 +02:00
|
|
|
|
|
|
|
###
|
|
|
|
# Copyright (c) 2003, Daniel DiPaolo
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# * Redistributions of source code must retain the above copyright notice,
|
|
|
|
# this list of conditions, and the following disclaimer.
|
|
|
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
# this list of conditions, and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
# * Neither the name of the author of this software nor the name of
|
|
|
|
# contributors to this software may be used to endorse or promote products
|
|
|
|
# derived from this software without specific prior written consent.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
###
|
|
|
|
|
2003-12-02 13:27:45 +01:00
|
|
|
from testsupport import *
|
2003-10-13 23:22:16 +02:00
|
|
|
|
|
|
|
try:
|
|
|
|
import sqlite
|
|
|
|
except ImportError:
|
|
|
|
sqlite = None
|
|
|
|
|
|
|
|
if sqlite is not None:
|
2003-11-10 11:46:57 +01:00
|
|
|
MoobotFactoids = Owner.loadPluginModule('MoobotFactoids')
|
2003-11-10 23:43:19 +01:00
|
|
|
MF = MoobotFactoids
|
2004-02-16 05:12:35 +01:00
|
|
|
class OptionListTestCase(SupyTestCase):
|
2004-02-17 06:00:00 +01:00
|
|
|
maxIterations = 267
|
|
|
|
def _testOptions(self, s, L):
|
|
|
|
max = self.maxIterations
|
|
|
|
original = L[:]
|
|
|
|
while max and L:
|
|
|
|
max -= 1
|
|
|
|
option = MF.pickOptions(s)
|
|
|
|
self.failUnless(option in original,
|
|
|
|
'Option %s not in %s' % (option, original))
|
|
|
|
if option in L:
|
|
|
|
L.remove(option)
|
|
|
|
self.failIf(L, 'Some options never seen: %s' % L)
|
|
|
|
|
2003-11-14 16:49:13 +01:00
|
|
|
def testPickOptions(self):
|
2004-02-17 06:00:00 +01:00
|
|
|
self._testOptions('(a|b)', ['a', 'b'])
|
|
|
|
self._testOptions('a', ['a'])
|
|
|
|
self._testOptions('(a|b (c|d))', ['a', 'b c', 'b d'])
|
|
|
|
self._testOptions('(a|(b|)c)', ['a', 'ab', 'cd', 'd'])
|
|
|
|
self._testOptions('(a|(b|)|(c|)d)', ['a', 'ab', 'cd', 'd'])
|
|
|
|
self._testOptions('(a|)', ['a', ''])
|
|
|
|
self._testOptions('(|a)', ['a', ''])
|
|
|
|
self._testOptions('((a)|(b))', ['(a)', '(b)'])
|
2003-11-10 21:25:24 +01:00
|
|
|
|
2003-10-13 23:22:16 +02:00
|
|
|
class FactoidsTestCase(PluginTestCase, PluginDocumentation):
|
2003-10-28 06:31:51 +01:00
|
|
|
plugins = ('MoobotFactoids', 'User', 'Utilities')
|
2003-10-13 23:22:16 +02:00
|
|
|
def setUp(self):
|
|
|
|
PluginTestCase.setUp(self)
|
|
|
|
# Create a valid user to use
|
|
|
|
self.prefix = 'foo!bar@baz'
|
|
|
|
self.assertNotError('register tester moo')
|
2003-10-16 04:03:35 +02:00
|
|
|
|
2003-10-28 16:30:43 +01:00
|
|
|
def testAddFactoid(self):
|
|
|
|
self.assertNotError('moo is foo')
|
|
|
|
# Check stripping punctuation
|
|
|
|
self.assertError('moo!? is foo') # 'moo' already exists
|
|
|
|
self.assertNotError('foo!? is foo')
|
|
|
|
self.assertResponse('foo', 'foo is foo')
|
2003-11-01 23:08:52 +01:00
|
|
|
self.assertNotError('bar is <reply>moo is moo')
|
|
|
|
self.assertResponse('bar', 'moo is moo')
|
2003-11-03 00:45:31 +01:00
|
|
|
# Check substitution
|
|
|
|
self.assertNotError('who is <reply>$who')
|
|
|
|
self.assertResponse('who', 'foo')
|
2004-01-12 00:22:59 +01:00
|
|
|
# Check that actions ("\x01ACTION...") don't match
|
|
|
|
self.assertNoResponse('\x01ACTION\x01 is doing something', 3)
|
2003-10-28 16:30:43 +01:00
|
|
|
|
2003-10-13 23:22:16 +02:00
|
|
|
def testLiteral(self):
|
|
|
|
self.assertError('literal moo') # no factoids yet
|
|
|
|
self.assertNotError('moo is <reply>foo')
|
2003-10-16 04:03:35 +02:00
|
|
|
self.assertResponse('literal moo', '<reply>foo')
|
2003-10-13 23:22:16 +02:00
|
|
|
self.assertNotError('moo2 is moo!')
|
2003-10-16 04:03:35 +02:00
|
|
|
self.assertResponse('literal moo2', 'moo!')
|
2003-10-14 17:17:08 +02:00
|
|
|
self.assertNotError('moo3 is <action>foo')
|
2003-10-16 04:03:35 +02:00
|
|
|
self.assertResponse('literal moo3', '<action>foo')
|
2003-10-14 17:17:08 +02:00
|
|
|
|
|
|
|
def testGetFactoid(self):
|
|
|
|
self.assertNotError('moo is <reply>foo')
|
2003-10-16 04:03:35 +02:00
|
|
|
self.assertResponse('moo', 'foo')
|
2003-10-14 17:17:08 +02:00
|
|
|
self.assertNotError('moo2 is moo!')
|
2003-10-16 04:03:35 +02:00
|
|
|
self.assertResponse('moo2', 'moo2 is moo!')
|
2003-10-14 17:17:08 +02:00
|
|
|
self.assertNotError('moo3 is <action>foo')
|
|
|
|
self.assertAction('moo3', 'foo')
|
2003-10-16 04:03:35 +02:00
|
|
|
# Test and make sure it's parsing
|
|
|
|
self.assertNotError('moo4 is <reply>(1|2|3)')
|
|
|
|
self.assertRegexp('moo4', '^(1|2|3)$')
|
2003-10-24 03:03:18 +02:00
|
|
|
# Check case-insensitivity
|
|
|
|
self.assertResponse('MOO', 'foo')
|
|
|
|
self.assertResponse('mOo', 'foo')
|
|
|
|
self.assertResponse('MoO', 'foo')
|
2003-10-29 04:01:02 +01:00
|
|
|
# Check the "_is_" ability
|
|
|
|
self.assertNotError('delete moo')
|
|
|
|
self.assertNotError('moo _is_ <reply>foo')
|
|
|
|
self.assertResponse('moo', 'foo')
|
|
|
|
self.assertNotError('foo is bar _is_ baz')
|
|
|
|
self.assertResponse('foo is bar', 'foo is bar is baz')
|
2004-02-10 15:01:50 +01:00
|
|
|
# Check the "see ..." referencing
|
|
|
|
self.assertNotError('bar is see moo')
|
|
|
|
self.assertResponse('bar', 'foo')
|
|
|
|
self.assertNotError('bar2 _is_ see foo is bar')
|
|
|
|
self.assertResponse('bar2', 'foo is bar is baz')
|
2003-10-13 23:22:16 +02:00
|
|
|
|
2003-10-16 04:03:35 +02:00
|
|
|
def testFactinfo(self):
|
|
|
|
self.assertNotError('moo is <reply>foo')
|
|
|
|
self.assertRegexp('factinfo moo', '^moo: Created by tester on.*$')
|
|
|
|
self.assertNotError('moo')
|
2003-11-06 22:10:47 +01:00
|
|
|
self.assertRegexp('factinfo moo',
|
|
|
|
'^moo: Created by tester on'
|
2003-10-16 04:03:35 +02:00
|
|
|
'.*?\. Last requested by foo!bar@baz on .*?, '
|
|
|
|
'requested 1 time.$')
|
|
|
|
self.assertNotError('moo')
|
2003-11-06 22:10:47 +01:00
|
|
|
self.assertRegexp('factinfo moo',
|
|
|
|
'^moo: Created by tester on'
|
2003-10-16 04:03:35 +02:00
|
|
|
'.*?\. Last requested by foo!bar@baz on .*?, '
|
|
|
|
'requested 2 times.$')
|
|
|
|
self.assertNotError('moo =~ s/foo/bar/')
|
2003-11-06 22:10:47 +01:00
|
|
|
self.assertRegexp('factinfo moo',
|
|
|
|
'^moo: Created by tester on'
|
2003-10-16 04:03:35 +02:00
|
|
|
'.*?\. Last modified by tester on .*?\. '
|
|
|
|
'Last requested by foo!bar@baz on .*?, '
|
|
|
|
'requested 2 times.$')
|
|
|
|
self.assertNotError('lock moo')
|
2003-11-06 22:10:47 +01:00
|
|
|
self.assertRegexp('factinfo moo',
|
|
|
|
'^moo: Created by tester on'
|
2003-10-16 04:03:35 +02:00
|
|
|
'.*?\. Last modified by tester on .*?\. '
|
|
|
|
'Last requested by foo!bar@baz on .*?, '
|
2003-10-24 13:03:43 +02:00
|
|
|
'requested 2 times. '
|
|
|
|
'Locked by tester on .*\.$')
|
2003-10-16 04:03:35 +02:00
|
|
|
self.assertNotError('unlock moo')
|
2003-11-06 22:10:47 +01:00
|
|
|
self.assertRegexp('factinfo moo',
|
|
|
|
'^moo: Created by tester on'
|
2003-10-16 04:03:35 +02:00
|
|
|
'.*?\. Last modified by tester on .*?\. '
|
|
|
|
'Last requested by foo!bar@baz on .*?, '
|
|
|
|
'requested 2 times.$')
|
2003-10-16 07:27:01 +02:00
|
|
|
# Make sure I solved this bug
|
|
|
|
# Check and make sure all the other stuff is reset
|
|
|
|
self.assertNotError('foo is bar')
|
|
|
|
self.assertNotError('foo =~ s/bar/blah/')
|
|
|
|
self.assertNotError('foo')
|
|
|
|
self.assertNotError('no foo is baz')
|
2003-11-06 22:10:47 +01:00
|
|
|
self.assertRegexp('factinfo foo',
|
|
|
|
'^foo: Created by tester on'
|
2003-10-16 07:27:01 +02:00
|
|
|
'(?!(request|modif)).*?\.$')
|
2003-10-13 23:22:16 +02:00
|
|
|
|
2003-10-16 04:03:35 +02:00
|
|
|
def testLockUnlock(self):
|
|
|
|
self.assertNotError('moo is <reply>moo')
|
|
|
|
self.assertNotError('lock moo')
|
2003-11-06 22:10:47 +01:00
|
|
|
self.assertRegexp('factinfo moo',
|
|
|
|
'^moo: Created by tester on'
|
2003-10-24 13:03:43 +02:00
|
|
|
'.*?\. Locked by tester on .*?\.')
|
2003-10-16 04:03:35 +02:00
|
|
|
# switch user
|
|
|
|
self.prefix = 'moo!moo@moo'
|
|
|
|
self.assertNotError('register nottester moo')
|
|
|
|
self.assertError('unlock moo')
|
2003-11-06 22:10:47 +01:00
|
|
|
self.assertRegexp('factinfo moo',
|
|
|
|
'^moo: Created by tester on'
|
2003-10-24 13:03:43 +02:00
|
|
|
'.*?\. Locked by tester on .*?\.')
|
2003-10-16 04:03:35 +02:00
|
|
|
# switch back
|
|
|
|
self.prefix = 'foo!bar@baz'
|
|
|
|
self.assertNotError('identify tester moo')
|
|
|
|
self.assertNotError('unlock moo')
|
2003-11-06 22:10:47 +01:00
|
|
|
self.assertRegexp('factinfo moo',
|
|
|
|
'^moo: Created by tester on.*?\.')
|
2003-10-16 04:03:35 +02:00
|
|
|
|
|
|
|
def testChangeFactoid(self):
|
|
|
|
self.assertNotError('moo is <reply>moo')
|
|
|
|
self.assertNotError('moo =~ s/moo/moos/')
|
|
|
|
self.assertResponse('moo', 'moos')
|
|
|
|
self.assertNotError('moo =~ s/reply/action/')
|
|
|
|
self.assertAction('moo', 'moos')
|
|
|
|
self.assertNotError('moo =~ s/moos/(moos|woofs)/')
|
|
|
|
self.assertActionRegexp('moo', '^(moos|woofs)$')
|
|
|
|
self.assertError('moo =~ s/moo/')
|
|
|
|
|
2003-11-06 18:24:49 +01:00
|
|
|
def testMost(self):
|
2003-11-06 21:22:02 +01:00
|
|
|
userPrefix1 = 'moo!bar@baz'; userNick1 = 'moo'
|
|
|
|
userPrefix2 = 'boo!bar@baz'; userNick2 = 'boo'
|
|
|
|
self.irc.feedMsg(ircmsgs.privmsg(self.irc.nick,
|
|
|
|
'register %s bar' % userNick1,
|
|
|
|
prefix=userPrefix1))
|
|
|
|
self.irc.feedMsg(ircmsgs.privmsg(self.irc.nick,
|
|
|
|
'register %s bar' % userNick2,
|
|
|
|
prefix=userPrefix2))
|
|
|
|
_ = self.irc.takeMsg()
|
|
|
|
_ = self.irc.takeMsg()
|
2003-11-06 18:24:49 +01:00
|
|
|
# Check an empty database
|
2003-11-06 21:22:02 +01:00
|
|
|
self.assertError('most popular')
|
|
|
|
self.assertError('most authored')
|
|
|
|
self.assertError('most recent')
|
2003-11-06 18:24:49 +01:00
|
|
|
# Check singularity response
|
2003-11-06 21:22:02 +01:00
|
|
|
self.prefix = userPrefix1
|
2003-11-06 18:24:49 +01:00
|
|
|
self.assertNotError('moogle is <reply>moo')
|
2003-11-06 21:22:02 +01:00
|
|
|
self.assertError('most popular')
|
2003-11-06 22:22:13 +01:00
|
|
|
self.assertResponse('most authored',
|
|
|
|
'Most prolific author: moo (1)')
|
2004-02-17 05:49:00 +01:00
|
|
|
self.assertRegexp('most recent', "1 latest factoid:.*moogle")
|
2003-11-06 18:24:49 +01:00
|
|
|
self.assertResponse('moogle', 'moo')
|
2004-02-17 05:49:00 +01:00
|
|
|
self.assertRegexp('most popular',
|
|
|
|
"Top 1 requested factoid:.*moogle.*(1)")
|
2003-11-06 18:24:49 +01:00
|
|
|
# Check plural response
|
2003-11-06 21:22:02 +01:00
|
|
|
self.prefix = userPrefix2
|
2003-11-06 18:24:49 +01:00
|
|
|
self.assertNotError('mogle is <reply>mo')
|
2004-02-17 05:49:00 +01:00
|
|
|
self.assertRegexp('most authored',
|
|
|
|
'Most prolific authors:.*moo.*(1).*boo.*(1)')
|
|
|
|
self.assertRegexp('most recent',
|
|
|
|
"2 latest factoids:.*mogle.*moogle.*")
|
2003-11-06 18:24:49 +01:00
|
|
|
self.assertResponse('moogle', 'moo')
|
2004-02-17 05:49:00 +01:00
|
|
|
self.assertRegexp('most popular',
|
|
|
|
"Top 1 requested factoid:.*moogle.*(2)")
|
2003-11-06 18:24:49 +01:00
|
|
|
self.assertResponse('mogle', 'mo')
|
2004-02-17 05:49:00 +01:00
|
|
|
self.assertRegexp('most popular',
|
|
|
|
"Top 2 requested factoids:.*"
|
|
|
|
"moogle.*(2).*mogle.*(1)")
|
2003-11-06 21:22:02 +01:00
|
|
|
# Check most author ordering
|
|
|
|
self.assertNotError('moo is <reply>oom')
|
2004-02-17 05:49:00 +01:00
|
|
|
self.assertRegexp('most authored',
|
|
|
|
'Most prolific authors:.*boo.*(2).*moo.*(1)')
|
2003-11-06 18:24:49 +01:00
|
|
|
|
2003-10-16 04:03:35 +02:00
|
|
|
def testListkeys(self):
|
2004-02-10 15:01:50 +01:00
|
|
|
self.assertResponse('listkeys %', 'No keys matching "%" found.')
|
2003-10-16 04:03:35 +02:00
|
|
|
self.assertNotError('moo is <reply>moo')
|
2003-11-26 17:20:57 +01:00
|
|
|
# If only one key, it should respond with the factoid
|
|
|
|
self.assertResponse('listkeys moo', 'moo')
|
2004-02-10 15:01:50 +01:00
|
|
|
self.assertResponse('listkeys foo', 'No keys matching "foo" '
|
2003-10-16 05:51:53 +02:00
|
|
|
'found.')
|
2003-10-16 04:03:35 +02:00
|
|
|
# Throw in a bunch more
|
|
|
|
for i in range(10):
|
|
|
|
self.assertNotError('moo%s is <reply>moo' % i)
|
2003-11-06 22:10:47 +01:00
|
|
|
self.assertRegexp('listkeys moo',
|
2004-02-10 15:01:50 +01:00
|
|
|
'^Key search for "moo" '
|
|
|
|
'\(11 found\): ("moo\d*", )+and "moo9"$')
|
2003-10-16 05:51:53 +02:00
|
|
|
self.assertNotError('foo is bar')
|
2003-11-06 22:10:47 +01:00
|
|
|
self.assertRegexp('listkeys %',
|
2004-02-10 15:01:50 +01:00
|
|
|
'^Key search for "\%" '
|
|
|
|
'\(12 found\): "foo", ("moo\d*", )+and '
|
|
|
|
'"moo9"$')
|
2003-10-16 05:51:53 +02:00
|
|
|
# Check quoting
|
|
|
|
self.assertNotError('foo\' is bar')
|
2003-11-06 22:10:47 +01:00
|
|
|
self.assertResponse('listkeys foo',
|
2004-02-10 15:01:50 +01:00
|
|
|
'Key search for "foo" '
|
|
|
|
'(2 found): "foo" and "foo\'"')
|
|
|
|
# Check unicode stuff
|
|
|
|
self.assertResponse('listkeys Б', 'No keys matching "Б" found.')
|
|
|
|
self.assertNotError('АБВГДЕЖ is foo')
|
|
|
|
self.assertNotError('АБВГДЕЖЗИ is foo')
|
|
|
|
self.assertResponse('listkeys Б',
|
|
|
|
'Key search for "Б" '
|
|
|
|
'(2 found): "АБВГДЕЖ" and "АБВГДЕЖЗИ"')
|
2003-10-13 23:22:16 +02:00
|
|
|
|
2003-10-16 04:03:35 +02:00
|
|
|
def testListvalues(self):
|
2003-10-16 05:51:53 +02:00
|
|
|
self.assertNotError('moo is moo')
|
2003-11-06 22:10:47 +01:00
|
|
|
self.assertResponse('listvalues moo',
|
2004-02-10 15:01:50 +01:00
|
|
|
'Value search for "moo" (1 found): "moo"')
|
2003-10-16 04:03:35 +02:00
|
|
|
|
|
|
|
def testListauth(self):
|
|
|
|
self.assertNotError('moo is <reply>moo')
|
2003-10-24 13:03:43 +02:00
|
|
|
self.assertRegexp('listauth tester', 'tester.*\(1 found\):.*moo')
|
2003-10-16 05:51:53 +02:00
|
|
|
self.assertError('listauth moo')
|
2003-10-16 04:03:35 +02:00
|
|
|
|
2003-10-16 07:27:01 +02:00
|
|
|
def testDelete(self):
|
|
|
|
self.assertNotError('moo is <reply>moo')
|
|
|
|
self.assertNotError('lock moo')
|
|
|
|
self.assertError('delete moo')
|
|
|
|
self.assertNotError('unlock moo')
|
|
|
|
self.assertNotError('delete moo')
|
|
|
|
|
|
|
|
def testAugmentFactoid(self):
|
|
|
|
self.assertNotError('moo is foo')
|
|
|
|
self.assertNotError('moo is also bar')
|
|
|
|
self.assertResponse('moo', 'moo is foo, or bar')
|
2003-11-03 07:25:02 +01:00
|
|
|
self.assertNotError('moo is bar _is_ foo')
|
|
|
|
self.assertNotError('moo is bar is also foo')
|
|
|
|
self.assertResponse('moo is bar', 'moo is bar is foo, or foo')
|
2003-10-16 07:27:01 +02:00
|
|
|
|
|
|
|
def testReplaceFactoid(self):
|
|
|
|
self.assertNotError('moo is foo')
|
|
|
|
self.assertNotError('no moo is bar')
|
|
|
|
self.assertResponse('moo', 'moo is bar')
|
|
|
|
self.assertNotError('no, moo is baz')
|
|
|
|
self.assertResponse('moo', 'moo is baz')
|
|
|
|
self.assertNotError('lock moo')
|
|
|
|
self.assertError('no moo is qux')
|
2003-11-03 07:25:02 +01:00
|
|
|
self.assertNotError('foo is bar _is_ foo')
|
|
|
|
self.assertNotError('no foo is bar _is_ baz')
|
|
|
|
self.assertResponse('foo is bar', 'foo is bar is baz')
|
2003-10-16 07:27:01 +02:00
|
|
|
|
2003-10-21 22:47:55 +02:00
|
|
|
def testRegexpNotCalledIfAlreadyHandled(self):
|
|
|
|
self.assertResponse('echo foo is bar', 'foo is bar')
|
|
|
|
self.assertNoResponse(' ', 3)
|
|
|
|
|
2003-10-22 01:21:32 +02:00
|
|
|
def testNoResponseToCtcp(self):
|
|
|
|
self.assertNotError('foo is bar')
|
|
|
|
self.assertResponse('foo', 'foo is bar')
|
|
|
|
self.irc.feedMsg(ircmsgs.privmsg(self.irc.nick, '\x01VERSION\x01'))
|
|
|
|
m = self.irc.takeMsg()
|
|
|
|
self.failIf(m)
|
|
|
|
|
2003-12-19 23:37:04 +01:00
|
|
|
def testAddFactoidNotCalledWithBadNestingSyntax(self):
|
|
|
|
self.assertError('re s/Error:.*/jbm is a tard/ ]')
|
|
|
|
self.assertNoResponse(' ', 3)
|
2003-10-16 04:03:35 +02:00
|
|
|
|
2004-02-10 15:01:50 +01:00
|
|
|
def testConfigShowFactoidIfOnlyOneMatch(self):
|
|
|
|
# man these are long
|
|
|
|
MFconf = conf.supybot.plugins.MoobotFactoids
|
|
|
|
self.assertNotError('foo is bar')
|
|
|
|
# Default to saying the factoid value
|
|
|
|
self.assertResponse('listkeys foo', 'foo is bar')
|
|
|
|
# Check the False setting
|
|
|
|
MFconf.showFactoidIfOnlyOneMatch.setValue(False)
|
|
|
|
self.assertResponse('listkeys foo', 'Key search for "foo" '
|
|
|
|
'(1 found): "foo"')
|
|
|
|
|
|
|
|
|
2003-10-16 04:03:35 +02:00
|
|
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|