Fixed tests.

This commit is contained in:
Jeremy Fincher 2004-01-31 22:07:27 +00:00
parent b410a79d64
commit 03c46445d7

View File

@ -57,7 +57,8 @@ if sqlite:
def setUp(self): def setUp(self):
PluginTestCase.setUp(self) PluginTestCase.setUp(self)
fd = file(os.path.join(conf.dataDir, 'foo.supyfact'), 'w') dataDir = conf.supybot.directories.data()
fd = file(os.path.join(dataDir, 'foo.supyfact'), 'w')
for k, v in self.d.iteritems(): for k, v in self.d.iteritems():
fd.write('%s:%s\n' % (k, v)) fd.write('%s:%s\n' % (k, v))
fd.close() fd.close()
@ -73,17 +74,18 @@ if sqlite:
self.assertHelp('help test') self.assertHelp('help test')
self.assertNotError('lookup remove test') self.assertNotError('lookup remove test')
try: try:
original = conf.replyWhenNotCommand original = conf.supybot.reply.WhenNotCommand()
conf.replyWhenNotCommand = True conf.supybot.reply.WhenNotCommand.setValue(True)
self.assertError('test foo') self.assertError('test foo')
finally: finally:
conf.replyWhenNotCommand = original conf.supybot.reply.whenNotCommand.setValue(original)
def testNotEscapingIOError(self): def testNotEscapingIOError(self):
self.assertNotRegexp('lookup add foo asdlfkjsdalfkj', 'IOError') self.assertNotRegexp('lookup add foo asdlfkjsdalfkj', 'IOError')
def testEmptyLines(self): def testEmptyLines(self):
fd = file(os.path.join(conf.dataDir, 'foo.supyfact'), 'a') dataDir = conf.supybot.directories.data()
fd = file(os.path.join(dataDir, 'foo.supyfact'), 'a')
fd.write('\n') fd.write('\n')
fd.close() fd.close()
self.assertNotError('lookup add test foo.supyfact') self.assertNotError('lookup add test foo.supyfact')
@ -96,9 +98,10 @@ if sqlite:
self.assertRegexp('lookup search --regexp m/^b/ test', self.assertRegexp('lookup search --regexp m/^b/ test',
'bar: baz') 'bar: baz')
# Values searches. # Values searches.
self.assertResponse('search test --values mom', 'your mom: my mom') self.assertResponse('lookup search test --values mom',
self.assertResponse('search test --values b?r', 'foo: bar') 'your mom: my mom')
self.assertResponse('search --values --regexp m/bar/ test', self.assertResponse('lookup search test --values b?r', 'foo: bar')
self.assertResponse('lookup search --values --regexp m/bar/ test',
'foo: bar') 'foo: bar')
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: