Fixed Dunno.change and added a test to make sure it works

This commit is contained in:
Daniel DiPaolo 2004-02-05 06:00:44 +00:00
parent a027966aad
commit 0d2724d0f3
2 changed files with 7 additions and 1 deletions

View File

@ -202,11 +202,12 @@ class Dunno(callbacks.Privmsg):
except:
irc.error(msg, '%r is not a valid regexp' % regexp)
return
dunno = cursor.fetchone()[0]
new_dunno = replacer(dunno)
cursor.execute("""UPDATE dunnos SET dunno=%s WHERE id=%s""",
new_dunno, id)
self.db.commit()
irc.reply(msg, conf.replySuccess)
irc.replySuccess()

View File

@ -74,3 +74,8 @@ if sqlite is not None:
self.assertResponse('dunno get 2', 'Dunno #2: \'$who\'')
self.assertError('dunno get 3')
self.assertError('dunno get a')
def testDunnoChange(self):
self.assertNotError('dunno add moo')
self.assertNotError('dunno change 1 s/moo/bar/')
self.assertRegexp('dunno get 1', '.*?: \'bar\'')