mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Changed to handle non-installed sqlite.
This commit is contained in:
parent
e5d71ac10a
commit
dd9bd35fc2
@ -33,66 +33,73 @@ import sets
|
|||||||
|
|
||||||
from test import *
|
from test import *
|
||||||
|
|
||||||
|
try:
|
||||||
|
import sqlite
|
||||||
|
except ImportError:
|
||||||
|
sqlite = None
|
||||||
|
|
||||||
|
|
||||||
class QuoteGrabsTestCase(ChannelPluginTestCase, PluginDocumentation):
|
class QuoteGrabsTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||||
plugins = ('QuoteGrabs',)
|
plugins = ('QuoteGrabs',)
|
||||||
|
if sqlite:
|
||||||
|
def testQuoteGrab(self):
|
||||||
|
testPrefix = 'foo!bar@baz'
|
||||||
|
self.assertError('grab foo')
|
||||||
|
# Test join/part/notice (shouldn't grab)
|
||||||
|
self.irc.feedMsg(ircmsgs.join(self.channel, prefix=testPrefix))
|
||||||
|
self.assertError('grab foo')
|
||||||
|
self.irc.feedMsg(ircmsgs.part(self.channel, prefix=testPrefix))
|
||||||
|
self.assertError('grab foo')
|
||||||
|
# Test privmsgs
|
||||||
|
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'something',
|
||||||
|
prefix=testPrefix))
|
||||||
|
self.assertNotError('grab foo')
|
||||||
|
self.assertResponse('quote foo', '<foo> something')
|
||||||
|
# Test actions
|
||||||
|
self.irc.feedMsg(ircmsgs.action(self.channel, 'moos',
|
||||||
|
prefix=testPrefix))
|
||||||
|
self.assertNotError('grab foo')
|
||||||
|
self.assertResponse('quote foo', '* foo moos')
|
||||||
|
|
||||||
def testQuoteGrab(self):
|
def testList(self):
|
||||||
testPrefix = 'foo!bar@baz'
|
testPrefix = 'foo!bar@baz'
|
||||||
self.assertError('grab foo')
|
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'test',
|
||||||
# Test join/part/notice (shouldn't grab)
|
prefix=testPrefix))
|
||||||
self.irc.feedMsg(ircmsgs.join(self.channel, prefix=testPrefix))
|
self.assertNotError('grab foo')
|
||||||
self.assertError('grab foo')
|
self.assertResponse('quotegrabs list foo', '#1: test')
|
||||||
self.irc.feedMsg(ircmsgs.part(self.channel, prefix=testPrefix))
|
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'a' * 80,
|
||||||
self.assertError('grab foo')
|
prefix=testPrefix))
|
||||||
# Test privmsgs
|
self.assertNotError('grab foo')
|
||||||
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'something',
|
self.assertResponse('quotegrabs list foo',
|
||||||
prefix=testPrefix))
|
'#1: test and #2: %s...' %\
|
||||||
self.assertNotError('grab foo')
|
('a'*43)) # 50 - length of "#2: ..."
|
||||||
self.assertResponse('quote foo', '<foo> something')
|
|
||||||
# Test actions
|
|
||||||
self.irc.feedMsg(ircmsgs.action(self.channel, 'moos',
|
|
||||||
prefix=testPrefix))
|
|
||||||
self.assertNotError('grab foo')
|
|
||||||
self.assertResponse('quote foo', '* foo moos')
|
|
||||||
|
|
||||||
def testList(self):
|
def testDuplicateGrabs(self):
|
||||||
testPrefix = 'foo!bar@baz'
|
testPrefix = 'foo!bar@baz'
|
||||||
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'test',
|
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'test',
|
||||||
prefix=testPrefix))
|
prefix=testPrefix))
|
||||||
self.assertNotError('grab foo')
|
self.assertNotError('grab foo')
|
||||||
self.assertResponse('quotegrabs list foo', '#1: test')
|
self.assertNotError('grab foo') # note:NOTanerror,stillwon'tdupe
|
||||||
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'a' * 80,
|
self.assertResponse('quotegrabs list foo', '#1: test')
|
||||||
prefix=testPrefix))
|
|
||||||
self.assertNotError('grab foo')
|
|
||||||
self.assertResponse('quotegrabs list foo', '#1: test and #2: %s...' %\
|
|
||||||
('a'*43)) # 50 - length of "#2: ..."
|
|
||||||
|
|
||||||
def testDuplicateGrabs(self):
|
def testCaseInsensitivity(self):
|
||||||
testPrefix = 'foo!bar@baz'
|
testPrefix = 'foo!bar@baz'
|
||||||
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'test',
|
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'test',
|
||||||
prefix=testPrefix))
|
prefix=testPrefix))
|
||||||
self.assertNotError('grab foo')
|
self.assertNotError('grab FOO')
|
||||||
self.assertNotError('grab foo') # note: NOT an error, still won't dupe
|
self.assertNotError('quote foo')
|
||||||
self.assertResponse('quotegrabs list foo', '#1: test')
|
self.assertNotError('quote FoO')
|
||||||
|
self.assertNotError('quote Foo')
|
||||||
|
|
||||||
def testCaseInsensitivity(self):
|
def testGet(self):
|
||||||
testPrefix = 'foo!bar@baz'
|
testPrefix= 'foo!bar@baz'
|
||||||
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'test',
|
self.assertError('quotegrabs get asdf')
|
||||||
prefix=testPrefix))
|
self.assertError('quotegrabs get 1')
|
||||||
self.assertNotError('grab FOO')
|
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'test',
|
||||||
self.assertNotError('quote foo')
|
prefix=testPrefix))
|
||||||
self.assertNotError('quote FoO')
|
self.assertNotError('grab foo')
|
||||||
self.assertNotError('quote Foo')
|
self.assertRegexp('quotegrabs get 1',
|
||||||
|
'<foo> test \(Said by: foo!bar@baz on .*?\)')
|
||||||
def testGet(self):
|
|
||||||
testPrefix= 'foo!bar@baz'
|
|
||||||
self.assertError('quotegrabs get asdf')
|
|
||||||
self.assertError('quotegrabs get 1')
|
|
||||||
self.irc.feedMsg(ircmsgs.privmsg(self.channel, 'test',
|
|
||||||
prefix=testPrefix))
|
|
||||||
self.assertNotError('grab foo')
|
|
||||||
self.assertRegexp('quotegrabs get 1',
|
|
||||||
'<foo> test \(Said by: foo!bar@baz on .*?\)')
|
|
||||||
|
|
||||||
# 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