Changed the Lookup test to run even when SQLite isn't installed.

This commit is contained in:
Jeremy Fincher 2003-11-19 14:50:21 +00:00
parent baaa01755f
commit e5d71ac10a

View File

@ -42,27 +42,28 @@ class LookupTestCase(PluginTestCase, PluginDocumentation):
'bar': 'baz', 'bar': 'baz',
'your mom': 'my mom', 'your mom': 'my mom',
} }
def setUp(self): if sqlite:
PluginTestCase.setUp(self) def setUp(self):
fd = file(os.path.join(conf.dataDir, 'foo.supyfact'), 'w') PluginTestCase.setUp(self)
for k, v in self.d.iteritems(): fd = file(os.path.join(conf.dataDir, 'foo.supyfact'), 'w')
fd.write('%s:%s\n' % (k, v)) for k, v in self.d.iteritems():
fd.close() fd.write('%s:%s\n' % (k, v))
fd.close()
def test(self): def test(self):
self.assertNotError('lookup add test foo.supyfact') self.assertNotError('lookup add test foo.supyfact')
self.assertRegexp('test', r"(foo|bar|your mom): (bar|baz|my mom)") self.assertRegexp('test', r"(foo|bar|your mom): (bar|baz|my mom)")
self.assertResponse('test foo', 'bar') self.assertResponse('test foo', 'bar')
self.assertResponse('test bar', 'baz') self.assertResponse('test bar', 'baz')
self.assertResponse('test your mom', 'my mom') self.assertResponse('test your mom', 'my mom')
self.assertError('test something not in there') self.assertError('test something not in there')
self.assertNotError('lookup remove test') self.assertNotError('lookup remove test')
try: try:
original = conf.replyWhenNotCommand original = conf.replyWhenNotCommand
conf.replyWhenNotCommand = True conf.replyWhenNotCommand = True
self.assertError('test foo') self.assertError('test foo')
finally: finally:
conf.replyWhenNotCommand = original conf.replyWhenNotCommand = original