mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
plugins/Quotes.py: addquote now announces the id of the new quote
test/test_Quotes.py: updated to reflect change in plugin
This commit is contained in:
parent
91274d3f54
commit
f524ec0ac9
@ -89,9 +89,9 @@ class Quotes(ChannelDBHandler, callbacks.Privmsg):
|
||||
VALUES(NULL, %s, %s, %s)""",
|
||||
msg.nick, quotetime, quote)
|
||||
db.commit()
|
||||
criteria = ['added_by=%s' % msg.nick]
|
||||
criteria = ['added_by="%s"' % msg.nick]
|
||||
criteria.append('added_at=%s' % quotetime)
|
||||
criteria.append('quote=%s' % quote)
|
||||
criteria.append('quote="%s"' % quote)
|
||||
sql = """SELECT id FROM quotes WHERE %s""" % ' AND '.join(criteria)
|
||||
cursor.execute(sql)
|
||||
quoteid = cursor.fetchone()[0]
|
||||
|
@ -35,14 +35,14 @@ class QuotesTestCase(PluginTestCase, PluginDocumentation):
|
||||
plugins = ('Quotes',)
|
||||
def test(self):
|
||||
self.assertRegexp('numquotes #foo', '0')
|
||||
self.assertNotError('addquote #foo foo')
|
||||
self.assertRegexp('addquote #foo foo', 'Quote #1 added')
|
||||
self.assertRegexp('numquotes #foo', '1')
|
||||
self.assertResponse('quote #foo --id 1', '#1: foo')
|
||||
self.assertResponse('quote #foo 1', '#1: foo')
|
||||
self.assertNotError('addquote #foo bar')
|
||||
self.assertRegexp('addquote #foo bar','Quote #2 added')
|
||||
self.assertResponse('quote #foo 2', '#2: bar')
|
||||
self.assertResponse('quote #foo --id 2', '#2: bar')
|
||||
self.assertNotError('addquote #foo baz')
|
||||
self.assertRegexp('addquote #foo baz','Quote #3 added')
|
||||
self.assertRegexp('numquotes #foo', '3')
|
||||
self.assertResponse('quote #foo 3', '#3: baz')
|
||||
self.assertRegexp('quote #foo --regexp m/ba/', 'bar.*baz')
|
||||
|
Loading…
Reference in New Issue
Block a user