I should've run the tests earlier. Now adding the inital values to the db

actually works.
This commit is contained in:
James Vega 2004-08-30 02:03:38 +00:00
parent 9b00751ce0
commit a7379fe538
2 changed files with 7 additions and 2 deletions

View File

@ -242,12 +242,12 @@ class SqliteInfobotDB(object):
key TEXT UNIQUE ON CONFLICT REPLACE, key TEXT UNIQUE ON CONFLICT REPLACE,
value TEXT value TEXT
);""") );""")
db.commit()
for (k, v) in initialIs.iteritems(): for (k, v) in initialIs.iteritems():
self.setIs(k, v) self.setIs(k, v)
for (k, v) in initialAre.iteritems(): for (k, v) in initialAre.iteritems():
self.setAre(k, v) self.setAre(k, v)
self._changes = 0 self._changes = 0
db.commit()
return db return db
except sqlite.DatabaseError, e: except sqlite.DatabaseError, e:
raise dbi.InvalidDBError, str(e) raise dbi.InvalidDBError, str(e)

View File

@ -52,7 +52,8 @@ if sqlite is not None:
ibot.snarfUnaddressedDefinitions.setValue(True) ibot.snarfUnaddressedDefinitions.setValue(True)
ibot.answerUnaddressedQuestions.setValue(True) ibot.answerUnaddressedQuestions.setValue(True)
self.assertSnarfNoResponse('foo is at http://bar.com/', 2) 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.assertSnarfRegexp('foo?', r'foo.*is.*http://bar.com/')
self.assertSnarfNoResponse('foo is at http://baz.com/', 2) self.assertSnarfNoResponse('foo is at http://baz.com/', 2)
self.assertSnarfNotRegexp('foo?', 'baz') self.assertSnarfNotRegexp('foo?', 'baz')
@ -139,4 +140,8 @@ if sqlite is not None:
def testNoKarmaDunno(self): def testNoKarmaDunno(self):
self.assertNoResponse('foo++') 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: # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: