mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 02:24:12 +01:00
As part of the renaming madness, removed any ^db prefix
This commit is contained in:
parent
c14decfdea
commit
8a378601b3
@ -211,7 +211,7 @@ class FunDB(callbacks.Privmsg):
|
|||||||
(id, excuse) = cursor.fetchone()
|
(id, excuse) = cursor.fetchone()
|
||||||
irc.reply(msg, '%s (#%s)' % (excuse, id))
|
irc.reply(msg, '%s (#%s)' % (excuse, id))
|
||||||
|
|
||||||
def dbadd(self, irc, msg, args):
|
def add(self, irc, msg, args):
|
||||||
"""<lart|excuse|insult|praise> <text>
|
"""<lart|excuse|insult|praise> <text>
|
||||||
|
|
||||||
Adds another record to the data referred to in the first argument. For
|
Adds another record to the data referred to in the first argument. For
|
||||||
@ -247,7 +247,7 @@ class FunDB(callbacks.Privmsg):
|
|||||||
response = '%s (%s #%s)' % (conf.replySuccess, table, id)
|
response = '%s (%s #%s)' % (conf.replySuccess, table, id)
|
||||||
irc.reply(msg, response)
|
irc.reply(msg, response)
|
||||||
|
|
||||||
def dbremove(self, irc, msg, args):
|
def remove(self, irc, msg, args):
|
||||||
"""<lart|excuse|insult|praise> <id>
|
"""<lart|excuse|insult|praise> <id>
|
||||||
|
|
||||||
Removes the data, referred to in the first argument, with the id
|
Removes the data, referred to in the first argument, with the id
|
||||||
@ -275,7 +275,7 @@ class FunDB(callbacks.Privmsg):
|
|||||||
self.db.commit()
|
self.db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
|
|
||||||
def dbchange(self, irc, msg, args):
|
def change(self, irc, msg, args):
|
||||||
"""<lart|excuse|insult|praise> <id> <regexp>
|
"""<lart|excuse|insult|praise> <id> <regexp>
|
||||||
|
|
||||||
Changes the data, referred to in the first argument, with the id
|
Changes the data, referred to in the first argument, with the id
|
||||||
@ -320,7 +320,7 @@ class FunDB(callbacks.Privmsg):
|
|||||||
self.db.commit()
|
self.db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
|
|
||||||
def dbnum(self, irc, msg, args):
|
def num(self, irc, msg, args):
|
||||||
"""<lart|excuse|insult|praise>
|
"""<lart|excuse|insult|praise>
|
||||||
|
|
||||||
Returns the number of records, of the type specified, currently in
|
Returns the number of records, of the type specified, currently in
|
||||||
@ -339,7 +339,7 @@ class FunDB(callbacks.Privmsg):
|
|||||||
irc.reply(msg, 'There %s currently %s in my database.' % \
|
irc.reply(msg, 'There %s currently %s in my database.' % \
|
||||||
(utils.be(total), utils.nItems(total, table)))
|
(utils.be(total), utils.nItems(total, table)))
|
||||||
|
|
||||||
def dbget(self, irc, msg, args):
|
def get(self, irc, msg, args):
|
||||||
"""<lart|excuse|insult|praise> <id>
|
"""<lart|excuse|insult|praise> <id>
|
||||||
|
|
||||||
Gets the record with id <id> from the table specified.
|
Gets the record with id <id> from the table specified.
|
||||||
@ -364,7 +364,7 @@ class FunDB(callbacks.Privmsg):
|
|||||||
reply = cursor.fetchone()[0]
|
reply = cursor.fetchone()[0]
|
||||||
irc.reply(msg, reply)
|
irc.reply(msg, reply)
|
||||||
|
|
||||||
def dbinfo(self, irc, msg, args):
|
def info(self, irc, msg, args):
|
||||||
"""<lart|excuse|insult|praise> <id>
|
"""<lart|excuse|insult|praise> <id>
|
||||||
|
|
||||||
Gets the info for the record with id <id> from the table specified.
|
Gets the info for the record with id <id> from the table specified.
|
||||||
|
@ -40,108 +40,108 @@ if sqlite is not None:
|
|||||||
class TestFunDB(PluginTestCase, PluginDocumentation):
|
class TestFunDB(PluginTestCase, PluginDocumentation):
|
||||||
plugins = ('FunDB',)
|
plugins = ('FunDB',)
|
||||||
|
|
||||||
def testDbAdd(self):
|
def testAdd(self):
|
||||||
self.assertError('dbadd l4rt foo')
|
self.assertError('add l4rt foo')
|
||||||
self.assertError('dbadd lart foo')
|
self.assertError('add lart foo')
|
||||||
|
|
||||||
def testDbRemove(self):
|
def testRemove(self):
|
||||||
self.assertError('dbremove l4rt foo')
|
self.assertError('remove l4rt foo')
|
||||||
self.assertError('dbremove lart foo')
|
self.assertError('remove lart foo')
|
||||||
|
|
||||||
def testLart(self):
|
def testLart(self):
|
||||||
self.assertNotError('dbadd lart jabs $who')
|
self.assertNotError('add lart jabs $who')
|
||||||
self.assertRegexp('lart', '^lart \[<id>\]')
|
self.assertRegexp('lart', '^lart \[<id>\]')
|
||||||
self.assertResponse('lart jemfinch for being dumb',
|
self.assertResponse('lart jemfinch for being dumb',
|
||||||
'\x01ACTION jabs jemfinch for being dumb (#1)\x01')
|
'\x01ACTION jabs jemfinch for being dumb (#1)\x01')
|
||||||
self.assertResponse('lart jemfinch',
|
self.assertResponse('lart jemfinch',
|
||||||
'\x01ACTION jabs jemfinch (#1)\x01')
|
'\x01ACTION jabs jemfinch (#1)\x01')
|
||||||
self.assertNotError('dbnum lart')
|
self.assertNotError('num lart')
|
||||||
self.assertNotError('dbadd lart shoots $who')
|
self.assertNotError('add lart shoots $who')
|
||||||
self.assertRegexp('lart 1', '^lart \[<id>\]')
|
self.assertRegexp('lart 1', '^lart \[<id>\]')
|
||||||
self.assertResponse('lart 1 jemfinch',
|
self.assertResponse('lart 1 jemfinch',
|
||||||
'\x01ACTION jabs jemfinch (#1)\x01')
|
'\x01ACTION jabs jemfinch (#1)\x01')
|
||||||
self.assertResponse('lart 2 jemfinch for being dumb',
|
self.assertResponse('lart 2 jemfinch for being dumb',
|
||||||
'\x01ACTION shoots jemfinch for being dumb (#2)\x01')
|
'\x01ACTION shoots jemfinch for being dumb (#2)\x01')
|
||||||
self.assertNotError('dbremove lart 1')
|
self.assertNotError('remove lart 1')
|
||||||
self.assertNotError('dbnum lart')
|
self.assertNotError('num lart')
|
||||||
self.assertResponse('lart jemfinch',
|
self.assertResponse('lart jemfinch',
|
||||||
'\x01ACTION shoots jemfinch (#2)\x01')
|
'\x01ACTION shoots jemfinch (#2)\x01')
|
||||||
self.assertNotError('dbremove lart 2')
|
self.assertNotError('remove lart 2')
|
||||||
self.assertNotError('dbnum lart')
|
self.assertNotError('num lart')
|
||||||
self.assertError('lart jemfinch')
|
self.assertError('lart jemfinch')
|
||||||
|
|
||||||
def testExcuse(self):
|
def testExcuse(self):
|
||||||
self.assertNotError('dbadd excuse Power failure')
|
self.assertNotError('add excuse Power failure')
|
||||||
self.assertResponse('excuse', 'Power failure (#1)')
|
self.assertResponse('excuse', 'Power failure (#1)')
|
||||||
self.assertError('excuse a few random words')
|
self.assertError('excuse a few random words')
|
||||||
self.assertNotError('dbnum excuse')
|
self.assertNotError('num excuse')
|
||||||
self.assertNotError('dbadd excuse /pub/lunch')
|
self.assertNotError('add excuse /pub/lunch')
|
||||||
self.assertResponse('excuse 1', 'Power failure (#1)')
|
self.assertResponse('excuse 1', 'Power failure (#1)')
|
||||||
self.assertNotError('dbremove excuse 1')
|
self.assertNotError('remove excuse 1')
|
||||||
self.assertNotError('dbnum excuse')
|
self.assertNotError('num excuse')
|
||||||
self.assertResponse('excuse', '/pub/lunch (#2)')
|
self.assertResponse('excuse', '/pub/lunch (#2)')
|
||||||
self.assertNotError('dbremove excuse 2')
|
self.assertNotError('remove excuse 2')
|
||||||
self.assertNotError('dbnum excuse')
|
self.assertNotError('num excuse')
|
||||||
self.assertError('excuse')
|
self.assertError('excuse')
|
||||||
|
|
||||||
def testInsult(self):
|
def testInsult(self):
|
||||||
self.assertNotError('dbadd insult Fatty McFatty')
|
self.assertNotError('add insult Fatty McFatty')
|
||||||
self.assertNotError('insult jemfinch')
|
self.assertNotError('insult jemfinch')
|
||||||
self.assertNotError('dbnum insult')
|
self.assertNotError('num insult')
|
||||||
self.assertNotError('dbremove insult 1')
|
self.assertNotError('remove insult 1')
|
||||||
self.assertNotError('dbnum insult')
|
self.assertNotError('num insult')
|
||||||
self.assertError('insult jemfinch')
|
self.assertError('insult jemfinch')
|
||||||
|
|
||||||
def testPraise(self):
|
def testPraise(self):
|
||||||
self.assertNotError('dbadd praise pets $who')
|
self.assertNotError('add praise pets $who')
|
||||||
self.assertRegexp('praise', '^praise \[<id>\]')
|
self.assertRegexp('praise', '^praise \[<id>\]')
|
||||||
self.assertResponse('praise jemfinch for being him',
|
self.assertResponse('praise jemfinch for being him',
|
||||||
'\x01ACTION pets jemfinch for being him (#1)\x01')
|
'\x01ACTION pets jemfinch for being him (#1)\x01')
|
||||||
self.assertResponse('praise jemfinch',
|
self.assertResponse('praise jemfinch',
|
||||||
'\x01ACTION pets jemfinch (#1)\x01')
|
'\x01ACTION pets jemfinch (#1)\x01')
|
||||||
self.assertNotError('dbnum praise')
|
self.assertNotError('num praise')
|
||||||
self.assertNotError('dbadd praise gives $who a cookie')
|
self.assertNotError('add praise gives $who a cookie')
|
||||||
self.assertRegexp('praise 1', '^praise \[<id>\]')
|
self.assertRegexp('praise 1', '^praise \[<id>\]')
|
||||||
self.assertResponse('praise 1 jemfinch',
|
self.assertResponse('praise 1 jemfinch',
|
||||||
'\x01ACTION pets jemfinch (#1)\x01')
|
'\x01ACTION pets jemfinch (#1)\x01')
|
||||||
self.assertResponse('praise 2 jemfinch for being him',
|
self.assertResponse('praise 2 jemfinch for being him',
|
||||||
'\x01ACTION gives jemfinch a cookie for being him (#2)\x01')
|
'\x01ACTION gives jemfinch a cookie for being him (#2)\x01')
|
||||||
self.assertNotError('dbremove praise 1')
|
self.assertNotError('remove praise 1')
|
||||||
self.assertNotError('dbnum praise')
|
self.assertNotError('num praise')
|
||||||
self.assertResponse('praise jemfinch',
|
self.assertResponse('praise jemfinch',
|
||||||
'\x01ACTION gives jemfinch a cookie (#2)\x01')
|
'\x01ACTION gives jemfinch a cookie (#2)\x01')
|
||||||
self.assertNotError('dbremove praise 2')
|
self.assertNotError('remove praise 2')
|
||||||
self.assertNotError('dbnum praise')
|
self.assertNotError('num praise')
|
||||||
self.assertError('praise jemfinch')
|
self.assertError('praise jemfinch')
|
||||||
|
|
||||||
def testDbInfo(self):
|
def testInfo(self):
|
||||||
self.assertNotError('dbadd praise $who')
|
self.assertNotError('add praise $who')
|
||||||
self.assertNotError('dbinfo praise 1')
|
self.assertNotError('info praise 1')
|
||||||
self.assertNotError('dbremove praise 1')
|
self.assertNotError('remove praise 1')
|
||||||
self.assertError('dbinfo fake 1')
|
self.assertError('info fake 1')
|
||||||
|
|
||||||
def testDbGet(self):
|
def testGet(self):
|
||||||
self.assertError('dbget fake 1')
|
self.assertError('get fake 1')
|
||||||
self.assertError('dbget lart foo')
|
self.assertError('get lart foo')
|
||||||
self.assertNotError('dbadd praise pets $who')
|
self.assertNotError('add praise pets $who')
|
||||||
self.assertNotError('dbget praise 1')
|
self.assertNotError('get praise 1')
|
||||||
self.assertNotError('dbremove praise 1')
|
self.assertNotError('remove praise 1')
|
||||||
self.assertError('dbget praise 1')
|
self.assertError('get praise 1')
|
||||||
|
|
||||||
def testDbNum(self):
|
def testNum(self):
|
||||||
self.assertError('dbnum fake')
|
self.assertError('num fake')
|
||||||
self.assertError('dbnum 1')
|
self.assertError('num 1')
|
||||||
self.assertNotError('dbnum praise')
|
self.assertNotError('num praise')
|
||||||
self.assertNotError('dbnum lart')
|
self.assertNotError('num lart')
|
||||||
self.assertNotError('dbnum excuse')
|
self.assertNotError('num excuse')
|
||||||
self.assertNotError('dbnum insult')
|
self.assertNotError('num insult')
|
||||||
|
|
||||||
def testDbChange(self):
|
def testChange(self):
|
||||||
self.assertNotError('dbadd praise teaches $who perl')
|
self.assertNotError('add praise teaches $who perl')
|
||||||
self.assertNotError('dbchange praise 1 s/perl/python/')
|
self.assertNotError('change praise 1 s/perl/python/')
|
||||||
self.assertResponse('praise jemfinch', '\x01ACTION teaches'\
|
self.assertResponse('praise jemfinch', '\x01ACTION teaches'\
|
||||||
' jemfinch python (#1)\x01')
|
' jemfinch python (#1)\x01')
|
||||||
self.assertNotError('dbremove praise 1')
|
self.assertNotError('remove praise 1')
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user