mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Updated to make sure the test doesn't run if sqlite isn't installed.
This commit is contained in:
parent
3af3b4c985
commit
93cc17ab43
@ -31,19 +31,25 @@
|
|||||||
|
|
||||||
from test import *
|
from test import *
|
||||||
|
|
||||||
class ChannelDBTestCase(ChannelPluginTestCase, PluginDocumentation):
|
try:
|
||||||
plugins = ('ChannelDB',)
|
import sqlite
|
||||||
def test(self):
|
except ImportError:
|
||||||
self.assertNotError('channelstats')
|
sqlite = None
|
||||||
self.assertNotError('channelstats')
|
|
||||||
self.assertNotError('channelstats')
|
|
||||||
|
|
||||||
def testNoKeyErrorEscapeFromSeen(self):
|
if sqlite is not None:
|
||||||
self.assertRegexp('seen asldfkjasdlfkj', 'I have not seen')
|
class ChannelDBTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||||
self.assertNotRegexp('seen asldfkjasdlfkj', 'KeyError')
|
plugins = ('ChannelDB',)
|
||||||
|
def test(self):
|
||||||
|
self.assertNotError('channelstats')
|
||||||
|
self.assertNotError('channelstats')
|
||||||
|
self.assertNotError('channelstats')
|
||||||
|
|
||||||
def testNoKeyErrorStats(self):
|
def testNoKeyErrorEscapeFromSeen(self):
|
||||||
self.assertNotRegexp('stats sweede', 'KeyError')
|
self.assertRegexp('seen asldfkjasdlfkj', 'I have not seen')
|
||||||
|
self.assertNotRegexp('seen asldfkjasdlfkj', 'KeyError')
|
||||||
|
|
||||||
|
def testNoKeyErrorStats(self):
|
||||||
|
self.assertNotRegexp('stats sweede', 'KeyError')
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
@ -31,66 +31,74 @@
|
|||||||
|
|
||||||
from test import *
|
from test import *
|
||||||
|
|
||||||
class FactoidsTestCase(ChannelPluginTestCase, PluginDocumentation):
|
try:
|
||||||
plugins = ('Factoids',)
|
import sqlite
|
||||||
def testRandomfactoid(self):
|
except ImportError:
|
||||||
self.assertError('randomfactoid')
|
sqlite = None
|
||||||
self.assertNotError('learn jemfinch as my primary author')
|
|
||||||
self.assertRegexp('randomfactoid', 'primary author')
|
|
||||||
|
|
||||||
def testLearn(self):
|
if sqlite is not None:
|
||||||
self.assertNotError('learn jemfinch as my primary author')
|
class FactoidsTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||||
self.assertNotError('factoidinfo jemfinch')
|
plugins = ('Factoids',)
|
||||||
self.assertRegexp('whatis jemfinch', 'my primary author')
|
def testRandomfactoid(self):
|
||||||
self.assertRegexp('whatis JEMFINCH', 'my primary author')
|
self.assertError('randomfactoid')
|
||||||
self.assertNotError('learn jemfinch as a crappy assembly programmer')
|
self.assertNotError('learn jemfinch as my primary author')
|
||||||
self.assertRegexp('whatis jemfinch', r'.*primary author.*assembly')
|
self.assertRegexp('randomfactoid', 'primary author')
|
||||||
self.assertError('forget jemfinch')
|
|
||||||
self.assertError('forget jemfinch 3')
|
|
||||||
self.assertError('forget jemfinch 0')
|
|
||||||
self.assertNotError('forget jemfinch 2')
|
|
||||||
self.assertNotError('forget jemfinch 1')
|
|
||||||
self.assertError('whatis jemfinch')
|
|
||||||
self.assertError('factoidinfo jemfinch')
|
|
||||||
|
|
||||||
self.assertNotError('learn foo bar as baz')
|
def testLearn(self):
|
||||||
self.assertNotError('factoidinfo foo bar')
|
self.assertNotError('learn jemfinch as my primary author')
|
||||||
self.assertRegexp('whatis foo bar', 'baz')
|
self.assertNotError('factoidinfo jemfinch')
|
||||||
self.assertNotError('learn foo bar as quux')
|
self.assertRegexp('whatis jemfinch', 'my primary author')
|
||||||
self.assertRegexp('whatis foo bar', '.*baz.*quux')
|
self.assertRegexp('whatis JEMFINCH', 'my primary author')
|
||||||
self.assertError('forget foo bar')
|
self.assertNotError('learn jemfinch as a bad assembly programmer')
|
||||||
self.assertNotError('forget foo bar 2')
|
self.assertRegexp('whatis jemfinch', r'.*primary author.*assembly')
|
||||||
self.assertNotError('forget foo bar 1')
|
self.assertError('forget jemfinch')
|
||||||
self.assertError('whatis foo bar')
|
self.assertError('forget jemfinch 3')
|
||||||
self.assertError('factoidinfo foo bar')
|
self.assertError('forget jemfinch 0')
|
||||||
|
self.assertNotError('forget jemfinch 2')
|
||||||
self.assertRegexp('learn foo bar baz', '^learn') # No 'as'
|
self.assertNotError('forget jemfinch 1')
|
||||||
self.assertRegexp('learn foo bar', '^learn') # No 'as'
|
self.assertError('whatis jemfinch')
|
||||||
|
self.assertError('factoidinfo jemfinch')
|
||||||
|
|
||||||
def testSearchFactoids(self):
|
self.assertNotError('learn foo bar as baz')
|
||||||
self.assertNotError('learn jemfinch as my primary author')
|
self.assertNotError('factoidinfo foo bar')
|
||||||
self.assertNotError('learn strike as another cool guy working on me')
|
self.assertRegexp('whatis foo bar', 'baz')
|
||||||
self.assertNotError('learn inkedmn as another of my developers')
|
self.assertNotError('learn foo bar as quux')
|
||||||
self.assertNotError('learn jamessan as a developer of much python')
|
self.assertRegexp('whatis foo bar', '.*baz.*quux')
|
||||||
self.assertNotError('learn bwp as the author of my weather command')
|
self.assertError('forget foo bar')
|
||||||
self.assertRegexp('searchfactoids --regexp /.w./', 'bwp')
|
self.assertNotError('forget foo bar 2')
|
||||||
self.assertRegexp('searchfactoids --regexp /^.+i/', 'jemfinch.*strike')
|
self.assertNotError('forget foo bar 1')
|
||||||
self.assertNotRegexp('searchfactoids --regexp /^.+i/', 'inkedmn')
|
self.assertError('whatis foo bar')
|
||||||
self.assertRegexp('searchfactoids --regexp /^j/', 'jemfinch.*jamessan')
|
self.assertError('factoidinfo foo bar')
|
||||||
self.assertRegexp('searchfactoids j*', 'jemfinch.*jamessan')
|
|
||||||
self.assertRegexp('searchfactoids --exact ke',
|
|
||||||
'inkedmn.*strike|strike.*inkedmn')
|
|
||||||
self.assertRegexp('searchfactoids *ke*',
|
|
||||||
'inkedmn.*strike|strike.*inkedmn')
|
|
||||||
|
|
||||||
|
|
||||||
def testNotZeroIndexed(self):
|
self.assertRegexp('learn foo bar baz', '^learn') # No 'as'
|
||||||
self.assertNotError('learn foo as bar')
|
self.assertRegexp('learn foo bar', '^learn') # No 'as'
|
||||||
self.assertNotRegexp('factoidinfo foo', '#0')
|
|
||||||
self.assertNotRegexp('whatis foo', '#0')
|
def testSearchFactoids(self):
|
||||||
self.assertNotError('learn foo as baz')
|
self.assertNotError('learn jemfinch as my primary author')
|
||||||
self.assertNotRegexp('factoidinfo foo', '#0')
|
self.assertNotError('learn strike as a cool guy working on me')
|
||||||
self.assertNotRegexp('whatis foo', '#0')
|
self.assertNotError('learn inkedmn as another of my developers')
|
||||||
|
self.assertNotError('learn jamessan as a developer of much python')
|
||||||
|
self.assertNotError('learn bwp as author of my weather command')
|
||||||
|
self.assertRegexp('searchfactoids --regexp /.w./', 'bwp')
|
||||||
|
self.assertRegexp('searchfactoids --regexp /^.+i/',
|
||||||
|
'jemfinch.*strike')
|
||||||
|
self.assertNotRegexp('searchfactoids --regexp /^.+i/', 'inkedmn')
|
||||||
|
self.assertRegexp('searchfactoids --regexp /^j/',
|
||||||
|
'jemfinch.*jamessan')
|
||||||
|
self.assertRegexp('searchfactoids j*', 'jemfinch.*jamessan')
|
||||||
|
self.assertRegexp('searchfactoids --exact ke',
|
||||||
|
'inkedmn.*strike|strike.*inkedmn')
|
||||||
|
self.assertRegexp('searchfactoids *ke*',
|
||||||
|
'inkedmn.*strike|strike.*inkedmn')
|
||||||
|
|
||||||
|
|
||||||
|
def testNotZeroIndexed(self):
|
||||||
|
self.assertNotError('learn foo as bar')
|
||||||
|
self.assertNotRegexp('factoidinfo foo', '#0')
|
||||||
|
self.assertNotRegexp('whatis foo', '#0')
|
||||||
|
self.assertNotError('learn foo as baz')
|
||||||
|
self.assertNotRegexp('factoidinfo foo', '#0')
|
||||||
|
self.assertNotRegexp('whatis foo', '#0')
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
@ -31,85 +31,91 @@
|
|||||||
|
|
||||||
from test import *
|
from test import *
|
||||||
|
|
||||||
class TestFunDB(PluginTestCase, PluginDocumentation):
|
try:
|
||||||
plugins = ('FunDB',)
|
import sqlite
|
||||||
|
except ImportError:
|
||||||
|
sqlite = None
|
||||||
|
|
||||||
def testDbAdd(self):
|
if sqlite is not None:
|
||||||
self.assertError('dbadd l4rt foo')
|
class TestFunDB(PluginTestCase, PluginDocumentation):
|
||||||
self.assertError('dbadd lart foo')
|
plugins = ('FunDB',)
|
||||||
|
|
||||||
def testDbRemove(self):
|
def testDbAdd(self):
|
||||||
self.assertError('dbremove l4rt foo')
|
self.assertError('dbadd l4rt foo')
|
||||||
self.assertError('dbremove lart foo')
|
self.assertError('dbadd lart foo')
|
||||||
|
|
||||||
def testLart(self):
|
def testDbRemove(self):
|
||||||
self.assertNotError('dbadd lart jabs $who')
|
self.assertError('dbremove l4rt foo')
|
||||||
self.assertResponse('lart jemfinch for being dumb', '\x01ACTION'\
|
self.assertError('dbremove lart foo')
|
||||||
' jabs jemfinch for being dumb (#1)\x01')
|
|
||||||
self.assertResponse('lart jemfinch', '\x01ACTION jabs jemfinch'\
|
|
||||||
' (#1)\x01')
|
|
||||||
self.assertNotError('dbnum lart')
|
|
||||||
self.assertNotError('dbremove lart 1')
|
|
||||||
self.assertNotError('dbnum lart')
|
|
||||||
self.assertError('lart jemfinch')
|
|
||||||
|
|
||||||
def testExcuse(self):
|
def testLart(self):
|
||||||
self.assertNotError('dbadd excuse Power failure')
|
self.assertNotError('dbadd lart jabs $who')
|
||||||
self.assertNotError('excuse')
|
self.assertResponse('lart jemfinch for being dumb', '\x01ACTION'\
|
||||||
self.assertNotError('excuse a few random words')
|
' jabs jemfinch for being dumb (#1)\x01')
|
||||||
self.assertNotError('dbnum excuse')
|
self.assertResponse('lart jemfinch', '\x01ACTION jabs jemfinch'\
|
||||||
self.assertNotError('dbremove excuse 1')
|
' (#1)\x01')
|
||||||
self.assertNotError('dbnum excuse')
|
self.assertNotError('dbnum lart')
|
||||||
self.assertError('excuse')
|
self.assertNotError('dbremove lart 1')
|
||||||
|
self.assertNotError('dbnum lart')
|
||||||
|
self.assertError('lart jemfinch')
|
||||||
|
|
||||||
def testInsult(self):
|
def testExcuse(self):
|
||||||
self.assertNotError('dbadd insult Fatty McFatty')
|
self.assertNotError('dbadd excuse Power failure')
|
||||||
self.assertNotError('insult jemfinch')
|
self.assertNotError('excuse')
|
||||||
self.assertNotError('dbnum insult')
|
self.assertNotError('excuse a few random words')
|
||||||
self.assertNotError('dbremove insult 1')
|
self.assertNotError('dbnum excuse')
|
||||||
self.assertNotError('dbnum insult')
|
self.assertNotError('dbremove excuse 1')
|
||||||
self.assertError('insult jemfinch')
|
self.assertNotError('dbnum excuse')
|
||||||
|
self.assertError('excuse')
|
||||||
|
|
||||||
def testPraise(self):
|
def testInsult(self):
|
||||||
self.assertNotError('dbadd praise pets $who')
|
self.assertNotError('dbadd insult Fatty McFatty')
|
||||||
self.assertNotError('praise jemfinch')
|
self.assertNotError('insult jemfinch')
|
||||||
self.assertResponse('praise jemfinch for being him', '\x01ACTION'\
|
self.assertNotError('dbnum insult')
|
||||||
' pets jemfinch for being him (#1)\x01')
|
self.assertNotError('dbremove insult 1')
|
||||||
self.assertResponse('praise jemfinch', '\x01ACTION pets jemfinch'\
|
self.assertNotError('dbnum insult')
|
||||||
' (#1)\x01')
|
self.assertError('insult jemfinch')
|
||||||
self.assertNotError('dbnum praise')
|
|
||||||
self.assertNotError('dbremove praise 1')
|
|
||||||
self.assertNotError('dbnum praise')
|
|
||||||
self.assertError('praise jemfinch')
|
|
||||||
|
|
||||||
def testDbInfo(self):
|
def testPraise(self):
|
||||||
self.assertNotError('dbadd praise $who')
|
self.assertNotError('dbadd praise pets $who')
|
||||||
self.assertNotError('dbinfo praise 1')
|
self.assertNotError('praise jemfinch')
|
||||||
self.assertNotError('dbremove praise 1')
|
self.assertResponse('praise jemfinch for being him', '\x01ACTION'\
|
||||||
self.assertError('dbinfo fake 1')
|
' pets jemfinch for being him (#1)\x01')
|
||||||
|
self.assertResponse('praise jemfinch', '\x01ACTION pets jemfinch'\
|
||||||
|
' (#1)\x01')
|
||||||
|
self.assertNotError('dbnum praise')
|
||||||
|
self.assertNotError('dbremove praise 1')
|
||||||
|
self.assertNotError('dbnum praise')
|
||||||
|
self.assertError('praise jemfinch')
|
||||||
|
|
||||||
def testDbGet(self):
|
def testDbInfo(self):
|
||||||
self.assertError('dbget fake 1')
|
self.assertNotError('dbadd praise $who')
|
||||||
self.assertError('dbget lart foo')
|
self.assertNotError('dbinfo praise 1')
|
||||||
self.assertNotError('dbadd praise pets $who')
|
self.assertNotError('dbremove praise 1')
|
||||||
self.assertNotError('dbget praise 1')
|
self.assertError('dbinfo fake 1')
|
||||||
self.assertNotError('dbremove praise 1')
|
|
||||||
self.assertError('dbget praise 1')
|
|
||||||
|
|
||||||
def testDbNum(self):
|
def testDbGet(self):
|
||||||
self.assertError('dbnum fake')
|
self.assertError('dbget fake 1')
|
||||||
self.assertError('dbnum 1')
|
self.assertError('dbget lart foo')
|
||||||
self.assertNotError('dbnum praise')
|
self.assertNotError('dbadd praise pets $who')
|
||||||
self.assertNotError('dbnum lart')
|
self.assertNotError('dbget praise 1')
|
||||||
self.assertNotError('dbnum excuse')
|
self.assertNotError('dbremove praise 1')
|
||||||
self.assertNotError('dbnum insult')
|
self.assertError('dbget praise 1')
|
||||||
|
|
||||||
def testDbChange(self):
|
def testDbNum(self):
|
||||||
self.assertNotError('dbadd praise teaches $who perl')
|
self.assertError('dbnum fake')
|
||||||
self.assertNotError('dbchange praise 1 s/perl/python/')
|
self.assertError('dbnum 1')
|
||||||
self.assertResponse('praise jemfinch', '\x01ACTION teaches'\
|
self.assertNotError('dbnum praise')
|
||||||
' jemfinch python (#1)\x01')
|
self.assertNotError('dbnum lart')
|
||||||
self.assertNotError('dbremove praise 1')
|
self.assertNotError('dbnum excuse')
|
||||||
|
self.assertNotError('dbnum insult')
|
||||||
|
|
||||||
|
def testDbChange(self):
|
||||||
|
self.assertNotError('dbadd praise teaches $who perl')
|
||||||
|
self.assertNotError('dbchange praise 1 s/perl/python/')
|
||||||
|
self.assertResponse('praise jemfinch', '\x01ACTION teaches'\
|
||||||
|
' jemfinch python (#1)\x01')
|
||||||
|
self.assertNotError('dbremove praise 1')
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
|
||||||
|
@ -33,21 +33,28 @@ from test import *
|
|||||||
|
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
class NewsTestCase(ChannelPluginTestCase):
|
try:
|
||||||
plugins = ('News',)
|
import sqlite
|
||||||
def testAddNews(self):
|
except ImportError:
|
||||||
self.assertNotError('addnews #somechannel 0 subject: foo')
|
sqlite = None
|
||||||
self.assertNotError('addnews 0 subject2: foo2')
|
|
||||||
|
|
||||||
def testListNews(self):
|
if sqlite is not None:
|
||||||
# These should both fail first, as they will have nothing in the DB
|
class NewsTestCase(ChannelPluginTestCase):
|
||||||
self.assertError('listnews')
|
plugins = ('News',)
|
||||||
self.assertError('listnews #channel')
|
def testAddNews(self):
|
||||||
# Now we'll add news and make sure listnews doesn't fail
|
self.assertNotError('addnews #somechannel 0 subject: foo')
|
||||||
self.assertNotError('addnews #channel 0 subject: foo')
|
self.assertNotError('addnews 0 subject2: foo2')
|
||||||
self.assertNotError('listnews #channel')
|
|
||||||
self.assertNotError('addnews 0 subject: foo')
|
def testListNews(self):
|
||||||
self.assertNotError('listnews')
|
# These should both fail first, as they will have nothing in the DB
|
||||||
|
self.assertError('listnews')
|
||||||
|
self.assertError('listnews #channel')
|
||||||
|
# Now we'll add news and make sure listnews doesn't fail
|
||||||
|
self.assertNotError('addnews #channel 0 subject: foo')
|
||||||
|
self.assertNotError('listnews #channel')
|
||||||
|
self.assertNotError('addnews 0 subject: foo')
|
||||||
|
self.assertNotError('listnews')
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
|
||||||
|
@ -34,31 +34,37 @@ from test import *
|
|||||||
import utils
|
import utils
|
||||||
import ircdb
|
import ircdb
|
||||||
|
|
||||||
class NotesTestCase(PluginTestCase, PluginDocumentation):
|
try:
|
||||||
plugins = ('Notes', 'MiscCommands', 'UserCommands')
|
import sqlite
|
||||||
def testHelps(self):
|
except ImportError:
|
||||||
self.assertNotError('help sendnote')
|
sqlite = None
|
||||||
self.assertNotError('list Notes')
|
|
||||||
|
|
||||||
def testSendnote(self):
|
|
||||||
#print repr(ircdb.users.getUser(self.prefix))
|
|
||||||
self.prefix = 'foo!bar@baz'
|
|
||||||
self.assertNotError('register foo bar')
|
|
||||||
(id, u) = ircdb.users.newUser()
|
|
||||||
u.name = 'inkedmn'
|
|
||||||
ircdb.users.setUser(id, u)
|
|
||||||
self.assertNotError('sendnote inkedmn test')
|
|
||||||
self.assertError('sendnote alsdkjfasldk foo')
|
|
||||||
|
|
||||||
def testNote(self):
|
|
||||||
# self.assertNotError('note 1')
|
|
||||||
self.assertError('note blah')
|
|
||||||
|
|
||||||
def testNotes(self):
|
if sqlite is not None:
|
||||||
self.assertNotError('notes')
|
class NotesTestCase(PluginTestCase, PluginDocumentation):
|
||||||
|
plugins = ('Notes', 'MiscCommands', 'UserCommands')
|
||||||
|
def testHelps(self):
|
||||||
|
self.assertNotError('help sendnote')
|
||||||
|
self.assertNotError('list Notes')
|
||||||
|
|
||||||
def testOldNotes(self):
|
def testSendnote(self):
|
||||||
self.assertNotError('oldnotes')
|
#print repr(ircdb.users.getUser(self.prefix))
|
||||||
|
self.prefix = 'foo!bar@baz'
|
||||||
|
self.assertNotError('register foo bar')
|
||||||
|
(id, u) = ircdb.users.newUser()
|
||||||
|
u.name = 'inkedmn'
|
||||||
|
ircdb.users.setUser(id, u)
|
||||||
|
self.assertNotError('sendnote inkedmn test')
|
||||||
|
self.assertError('sendnote alsdkjfasldk foo')
|
||||||
|
|
||||||
|
def testNote(self):
|
||||||
|
# self.assertNotError('note 1')
|
||||||
|
self.assertError('note blah')
|
||||||
|
|
||||||
|
def testNotes(self):
|
||||||
|
self.assertNotError('notes')
|
||||||
|
|
||||||
|
def testOldNotes(self):
|
||||||
|
self.assertNotError('oldnotes')
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
@ -31,38 +31,44 @@
|
|||||||
|
|
||||||
from test import *
|
from test import *
|
||||||
|
|
||||||
class QuotesTestCase(PluginTestCase, PluginDocumentation):
|
try:
|
||||||
plugins = ('Quotes',)
|
import sqlite
|
||||||
def test(self):
|
except ImportError:
|
||||||
self.assertRegexp('numquotes #foo', '0')
|
sqlite = None
|
||||||
self.assertRegexp('addquote #foo foo', 'Quote #1 added')
|
|
||||||
self.assertRegexp('numquotes #foo', '1')
|
if sqlite is not None:
|
||||||
self.assertResponse('quote #foo --id 1', '#1: foo')
|
class QuotesTestCase(PluginTestCase, PluginDocumentation):
|
||||||
self.assertResponse('quote #foo 1', '#1: foo')
|
plugins = ('Quotes',)
|
||||||
self.assertRegexp('addquote #foo bar','Quote #2 added')
|
def test(self):
|
||||||
self.assertResponse('quote #foo 2', '#2: bar')
|
self.assertRegexp('numquotes #foo', '0')
|
||||||
self.assertResponse('quote #foo --id 2', '#2: bar')
|
self.assertRegexp('addquote #foo foo', 'Quote #1 added')
|
||||||
self.assertRegexp('addquote #foo baz','Quote #3 added')
|
self.assertRegexp('numquotes #foo', '1')
|
||||||
self.assertRegexp('numquotes #foo', '3')
|
self.assertResponse('quote #foo --id 1', '#1: foo')
|
||||||
self.assertResponse('quote #foo 3', '#3: baz')
|
self.assertResponse('quote #foo 1', '#1: foo')
|
||||||
self.assertRegexp('quote #foo --regexp m/ba/', 'bar.*baz')
|
self.assertRegexp('addquote #foo bar','Quote #2 added')
|
||||||
self.assertRegexp('quote #foo --regexp ba', 'bar.*baz')
|
self.assertResponse('quote #foo 2', '#2: bar')
|
||||||
self.assertRegexp('quote #foo --with bar', '#2: bar')
|
self.assertResponse('quote #foo --id 2', '#2: bar')
|
||||||
self.assertRegexp('quote #foo bar', '#2: bar')
|
self.assertRegexp('addquote #foo baz','Quote #3 added')
|
||||||
self.assertNotError('quoteinfo #foo 1')
|
self.assertRegexp('numquotes #foo', '3')
|
||||||
self.assertNotError('randomquote #foo')
|
self.assertResponse('quote #foo 3', '#3: baz')
|
||||||
self.assertError('removequote #foo 4')
|
self.assertRegexp('quote #foo --regexp m/ba/', 'bar.*baz')
|
||||||
self.assertError('quoteinfo #foo 4')
|
self.assertRegexp('quote #foo --regexp ba', 'bar.*baz')
|
||||||
self.assertNotError('removequote #foo 3')
|
self.assertRegexp('quote #foo --with bar', '#2: bar')
|
||||||
self.assertRegexp('numquotes #foo', '2')
|
self.assertRegexp('quote #foo bar', '#2: bar')
|
||||||
self.assertNotError('removequote #foo 1')
|
self.assertNotError('quoteinfo #foo 1')
|
||||||
self.assertError('quoteinfo #foo 3')
|
self.assertNotError('randomquote #foo')
|
||||||
self.assertError('quoteinfo #foo 1')
|
self.assertError('removequote #foo 4')
|
||||||
self.assertRegexp('randomquote #foo', '#2')
|
self.assertError('quoteinfo #foo 4')
|
||||||
self.assertError('removequote #foo 3')
|
self.assertNotError('removequote #foo 3')
|
||||||
self.assertNotError('removequote #foo 2')
|
self.assertRegexp('numquotes #foo', '2')
|
||||||
self.assertRegexp('numquotes #foo', '0')
|
self.assertNotError('removequote #foo 1')
|
||||||
self.assertError('randomquote #foo')
|
self.assertError('quoteinfo #foo 3')
|
||||||
|
self.assertError('quoteinfo #foo 1')
|
||||||
|
self.assertRegexp('randomquote #foo', '#2')
|
||||||
|
self.assertError('removequote #foo 3')
|
||||||
|
self.assertNotError('removequote #foo 2')
|
||||||
|
self.assertRegexp('numquotes #foo', '0')
|
||||||
|
self.assertError('randomquote #foo')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,33 +66,38 @@ http://gameknot.com/tsignup.pl
|
|||||||
http://lambda.weblogs.com/xml/rss.xml
|
http://lambda.weblogs.com/xml/rss.xml
|
||||||
""".strip().splitlines()
|
""".strip().splitlines()
|
||||||
|
|
||||||
|
try:
|
||||||
|
import sqlite
|
||||||
|
except ImportError:
|
||||||
|
sqlite = None
|
||||||
|
|
||||||
|
if sqlite is not None:
|
||||||
|
class URLSnarferTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||||
|
plugins = ('URLSnarfer',)
|
||||||
|
def test(self):
|
||||||
|
counter = 0
|
||||||
|
self.assertNotError('randomurl')
|
||||||
|
for url in urls:
|
||||||
|
self.assertRegexp('numurls', str(counter))
|
||||||
|
self.feedMsg(url)
|
||||||
|
counter += 1
|
||||||
|
self.assertNotError('geturl %s' % counter)
|
||||||
|
|
||||||
class URLSnarferTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|
||||||
plugins = ('URLSnarfer',)
|
|
||||||
def test(self):
|
|
||||||
counter = 0
|
|
||||||
self.assertNotError('randomurl')
|
|
||||||
for url in urls:
|
|
||||||
self.assertRegexp('numurls', str(counter))
|
self.assertRegexp('numurls', str(counter))
|
||||||
self.feedMsg(url)
|
self.assertRegexp('lasturl', re.escape(urls[-1]))
|
||||||
counter += 1
|
self.assertRegexp('lasturl --proto https', re.escape(urls[-3]))
|
||||||
self.assertNotError('geturl %s' % counter)
|
self.assertRegexp('lasturl --at gameknot.com', re.escape(urls[-2]))
|
||||||
|
self.assertRegexp('lasturl --with dhcp', re.escape(urls[-4]))
|
||||||
|
self.assertRegexp('lasturl --from alsdkjf', '^No')
|
||||||
|
self.assertNotError('randomurl')
|
||||||
|
|
||||||
self.assertRegexp('numurls', str(counter))
|
def testDefaultNotFancy(self):
|
||||||
self.assertRegexp('lasturl', re.escape(urls[-1]))
|
self.feedMsg(urls[0])
|
||||||
self.assertRegexp('lasturl --proto https', re.escape(urls[-3]))
|
self.assertResponse('lasturl', urls[0])
|
||||||
self.assertRegexp('lasturl --at gameknot.com', re.escape(urls[-2]))
|
|
||||||
self.assertRegexp('lasturl --with dhcp', re.escape(urls[-4]))
|
|
||||||
self.assertRegexp('lasturl --from alsdkjf', '^No')
|
|
||||||
self.assertNotError('randomurl')
|
|
||||||
|
|
||||||
def testDefaultNotFancy(self):
|
def testAction(self):
|
||||||
self.feedMsg(urls[0])
|
self.irc.feedMsg(ircmsgs.action(self.channel, urls[1]))
|
||||||
self.assertResponse('lasturl', urls[0])
|
self.assertNotRegexp('lasturl', '\\x01')
|
||||||
|
|
||||||
def testAction(self):
|
|
||||||
self.irc.feedMsg(ircmsgs.action(self.channel, urls[1]))
|
|
||||||
self.assertNotRegexp('lasturl', '\\x01')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user