From a7379fe538172b73c0b9bed4050023c00f3b1d38 Mon Sep 17 00:00:00 2001 From: James Vega Date: Mon, 30 Aug 2004 02:03:38 +0000 Subject: [PATCH] I should've run the tests earlier. Now adding the inital values to the db actually works. --- plugins/Infobot.py | 2 +- test/test_Infobot.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/Infobot.py b/plugins/Infobot.py index 696001976..921523b2a 100755 --- a/plugins/Infobot.py +++ b/plugins/Infobot.py @@ -242,12 +242,12 @@ class SqliteInfobotDB(object): key TEXT UNIQUE ON CONFLICT REPLACE, value TEXT );""") + db.commit() for (k, v) in initialIs.iteritems(): self.setIs(k, v) for (k, v) in initialAre.iteritems(): self.setAre(k, v) self._changes = 0 - db.commit() return db except sqlite.DatabaseError, e: raise dbi.InvalidDBError, str(e) diff --git a/test/test_Infobot.py b/test/test_Infobot.py index 7c30c3bfe..0fe319955 100644 --- a/test/test_Infobot.py +++ b/test/test_Infobot.py @@ -52,7 +52,8 @@ if sqlite is not None: ibot.snarfUnaddressedDefinitions.setValue(True) ibot.answerUnaddressedQuestions.setValue(True) self.assertSnarfNoResponse('foo is at http://bar.com/', 2) - self.assertRegexp('infobot stats', '1 change') + self.assertRegexp('infobot stats', '1 modification') + self.assertRegexp('infobot status', '1 modification') self.assertSnarfRegexp('foo?', r'foo.*is.*http://bar.com/') self.assertSnarfNoResponse('foo is at http://baz.com/', 2) self.assertSnarfNotRegexp('foo?', 'baz') @@ -139,4 +140,8 @@ if sqlite is not None: def testNoKarmaDunno(self): self.assertNoResponse('foo++') + def testPredefinedFactoids(self): + self.assertSnarfNoResponse('what?', 3) + self.assertRegexp('roses?', 'roses are red') + # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: