mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11: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 *
|
||||
|
||||
class ChannelDBTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
plugins = ('ChannelDB',)
|
||||
def test(self):
|
||||
self.assertNotError('channelstats')
|
||||
self.assertNotError('channelstats')
|
||||
self.assertNotError('channelstats')
|
||||
try:
|
||||
import sqlite
|
||||
except ImportError:
|
||||
sqlite = None
|
||||
|
||||
def testNoKeyErrorEscapeFromSeen(self):
|
||||
self.assertRegexp('seen asldfkjasdlfkj', 'I have not seen')
|
||||
self.assertNotRegexp('seen asldfkjasdlfkj', 'KeyError')
|
||||
if sqlite is not None:
|
||||
class ChannelDBTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
plugins = ('ChannelDB',)
|
||||
def test(self):
|
||||
self.assertNotError('channelstats')
|
||||
self.assertNotError('channelstats')
|
||||
self.assertNotError('channelstats')
|
||||
|
||||
def testNoKeyErrorStats(self):
|
||||
self.assertNotRegexp('stats sweede', 'KeyError')
|
||||
def testNoKeyErrorEscapeFromSeen(self):
|
||||
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:
|
||||
|
@ -31,66 +31,74 @@
|
||||
|
||||
from test import *
|
||||
|
||||
class FactoidsTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
plugins = ('Factoids',)
|
||||
def testRandomfactoid(self):
|
||||
self.assertError('randomfactoid')
|
||||
self.assertNotError('learn jemfinch as my primary author')
|
||||
self.assertRegexp('randomfactoid', 'primary author')
|
||||
try:
|
||||
import sqlite
|
||||
except ImportError:
|
||||
sqlite = None
|
||||
|
||||
def testLearn(self):
|
||||
self.assertNotError('learn jemfinch as my primary author')
|
||||
self.assertNotError('factoidinfo jemfinch')
|
||||
self.assertRegexp('whatis jemfinch', 'my primary author')
|
||||
self.assertRegexp('whatis JEMFINCH', 'my primary author')
|
||||
self.assertNotError('learn jemfinch as a crappy assembly programmer')
|
||||
self.assertRegexp('whatis jemfinch', r'.*primary author.*assembly')
|
||||
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')
|
||||
if sqlite is not None:
|
||||
class FactoidsTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
plugins = ('Factoids',)
|
||||
def testRandomfactoid(self):
|
||||
self.assertError('randomfactoid')
|
||||
self.assertNotError('learn jemfinch as my primary author')
|
||||
self.assertRegexp('randomfactoid', 'primary author')
|
||||
|
||||
self.assertNotError('learn foo bar as baz')
|
||||
self.assertNotError('factoidinfo foo bar')
|
||||
self.assertRegexp('whatis foo bar', 'baz')
|
||||
self.assertNotError('learn foo bar as quux')
|
||||
self.assertRegexp('whatis foo bar', '.*baz.*quux')
|
||||
self.assertError('forget foo bar')
|
||||
self.assertNotError('forget foo bar 2')
|
||||
self.assertNotError('forget foo bar 1')
|
||||
self.assertError('whatis foo bar')
|
||||
self.assertError('factoidinfo foo bar')
|
||||
|
||||
self.assertRegexp('learn foo bar baz', '^learn') # No 'as'
|
||||
self.assertRegexp('learn foo bar', '^learn') # No 'as'
|
||||
def testLearn(self):
|
||||
self.assertNotError('learn jemfinch as my primary author')
|
||||
self.assertNotError('factoidinfo jemfinch')
|
||||
self.assertRegexp('whatis jemfinch', 'my primary author')
|
||||
self.assertRegexp('whatis JEMFINCH', 'my primary author')
|
||||
self.assertNotError('learn jemfinch as a bad assembly programmer')
|
||||
self.assertRegexp('whatis jemfinch', r'.*primary author.*assembly')
|
||||
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')
|
||||
|
||||
def testSearchFactoids(self):
|
||||
self.assertNotError('learn jemfinch as my primary author')
|
||||
self.assertNotError('learn strike as another cool guy working on me')
|
||||
self.assertNotError('learn inkedmn as another of my developers')
|
||||
self.assertNotError('learn jamessan as a developer of much python')
|
||||
self.assertNotError('learn bwp as the 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')
|
||||
|
||||
self.assertNotError('learn foo bar as baz')
|
||||
self.assertNotError('factoidinfo foo bar')
|
||||
self.assertRegexp('whatis foo bar', 'baz')
|
||||
self.assertNotError('learn foo bar as quux')
|
||||
self.assertRegexp('whatis foo bar', '.*baz.*quux')
|
||||
self.assertError('forget foo bar')
|
||||
self.assertNotError('forget foo bar 2')
|
||||
self.assertNotError('forget foo bar 1')
|
||||
self.assertError('whatis foo bar')
|
||||
self.assertError('factoidinfo foo bar')
|
||||
|
||||
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')
|
||||
self.assertRegexp('learn foo bar baz', '^learn') # No 'as'
|
||||
self.assertRegexp('learn foo bar', '^learn') # No 'as'
|
||||
|
||||
def testSearchFactoids(self):
|
||||
self.assertNotError('learn jemfinch as my primary author')
|
||||
self.assertNotError('learn strike as a cool guy working on me')
|
||||
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:
|
||||
|
@ -31,85 +31,91 @@
|
||||
|
||||
from test import *
|
||||
|
||||
class TestFunDB(PluginTestCase, PluginDocumentation):
|
||||
plugins = ('FunDB',)
|
||||
try:
|
||||
import sqlite
|
||||
except ImportError:
|
||||
sqlite = None
|
||||
|
||||
def testDbAdd(self):
|
||||
self.assertError('dbadd l4rt foo')
|
||||
self.assertError('dbadd lart foo')
|
||||
if sqlite is not None:
|
||||
class TestFunDB(PluginTestCase, PluginDocumentation):
|
||||
plugins = ('FunDB',)
|
||||
|
||||
def testDbRemove(self):
|
||||
self.assertError('dbremove l4rt foo')
|
||||
self.assertError('dbremove lart foo')
|
||||
def testDbAdd(self):
|
||||
self.assertError('dbadd l4rt foo')
|
||||
self.assertError('dbadd lart foo')
|
||||
|
||||
def testLart(self):
|
||||
self.assertNotError('dbadd lart jabs $who')
|
||||
self.assertResponse('lart jemfinch for being dumb', '\x01ACTION'\
|
||||
' 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 testDbRemove(self):
|
||||
self.assertError('dbremove l4rt foo')
|
||||
self.assertError('dbremove lart foo')
|
||||
|
||||
def testExcuse(self):
|
||||
self.assertNotError('dbadd excuse Power failure')
|
||||
self.assertNotError('excuse')
|
||||
self.assertNotError('excuse a few random words')
|
||||
self.assertNotError('dbnum excuse')
|
||||
self.assertNotError('dbremove excuse 1')
|
||||
self.assertNotError('dbnum excuse')
|
||||
self.assertError('excuse')
|
||||
def testLart(self):
|
||||
self.assertNotError('dbadd lart jabs $who')
|
||||
self.assertResponse('lart jemfinch for being dumb', '\x01ACTION'\
|
||||
' 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 testInsult(self):
|
||||
self.assertNotError('dbadd insult Fatty McFatty')
|
||||
self.assertNotError('insult jemfinch')
|
||||
self.assertNotError('dbnum insult')
|
||||
self.assertNotError('dbremove insult 1')
|
||||
self.assertNotError('dbnum insult')
|
||||
self.assertError('insult jemfinch')
|
||||
def testExcuse(self):
|
||||
self.assertNotError('dbadd excuse Power failure')
|
||||
self.assertNotError('excuse')
|
||||
self.assertNotError('excuse a few random words')
|
||||
self.assertNotError('dbnum excuse')
|
||||
self.assertNotError('dbremove excuse 1')
|
||||
self.assertNotError('dbnum excuse')
|
||||
self.assertError('excuse')
|
||||
|
||||
def testPraise(self):
|
||||
self.assertNotError('dbadd praise pets $who')
|
||||
self.assertNotError('praise jemfinch')
|
||||
self.assertResponse('praise jemfinch for being him', '\x01ACTION'\
|
||||
' 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 testInsult(self):
|
||||
self.assertNotError('dbadd insult Fatty McFatty')
|
||||
self.assertNotError('insult jemfinch')
|
||||
self.assertNotError('dbnum insult')
|
||||
self.assertNotError('dbremove insult 1')
|
||||
self.assertNotError('dbnum insult')
|
||||
self.assertError('insult jemfinch')
|
||||
|
||||
def testDbInfo(self):
|
||||
self.assertNotError('dbadd praise $who')
|
||||
self.assertNotError('dbinfo praise 1')
|
||||
self.assertNotError('dbremove praise 1')
|
||||
self.assertError('dbinfo fake 1')
|
||||
def testPraise(self):
|
||||
self.assertNotError('dbadd praise pets $who')
|
||||
self.assertNotError('praise jemfinch')
|
||||
self.assertResponse('praise jemfinch for being him', '\x01ACTION'\
|
||||
' 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):
|
||||
self.assertError('dbget fake 1')
|
||||
self.assertError('dbget lart foo')
|
||||
self.assertNotError('dbadd praise pets $who')
|
||||
self.assertNotError('dbget praise 1')
|
||||
self.assertNotError('dbremove praise 1')
|
||||
self.assertError('dbget praise 1')
|
||||
def testDbInfo(self):
|
||||
self.assertNotError('dbadd praise $who')
|
||||
self.assertNotError('dbinfo praise 1')
|
||||
self.assertNotError('dbremove praise 1')
|
||||
self.assertError('dbinfo fake 1')
|
||||
|
||||
def testDbNum(self):
|
||||
self.assertError('dbnum fake')
|
||||
self.assertError('dbnum 1')
|
||||
self.assertNotError('dbnum praise')
|
||||
self.assertNotError('dbnum lart')
|
||||
self.assertNotError('dbnum excuse')
|
||||
self.assertNotError('dbnum insult')
|
||||
def testDbGet(self):
|
||||
self.assertError('dbget fake 1')
|
||||
self.assertError('dbget lart foo')
|
||||
self.assertNotError('dbadd praise pets $who')
|
||||
self.assertNotError('dbget praise 1')
|
||||
self.assertNotError('dbremove praise 1')
|
||||
self.assertError('dbget praise 1')
|
||||
|
||||
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')
|
||||
def testDbNum(self):
|
||||
self.assertError('dbnum fake')
|
||||
self.assertError('dbnum 1')
|
||||
self.assertNotError('dbnum praise')
|
||||
self.assertNotError('dbnum lart')
|
||||
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:
|
||||
|
||||
|
@ -33,21 +33,28 @@ from test import *
|
||||
|
||||
import utils
|
||||
|
||||
class NewsTestCase(ChannelPluginTestCase):
|
||||
plugins = ('News',)
|
||||
def testAddNews(self):
|
||||
self.assertNotError('addnews #somechannel 0 subject: foo')
|
||||
self.assertNotError('addnews 0 subject2: foo2')
|
||||
|
||||
def testListNews(self):
|
||||
# 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')
|
||||
try:
|
||||
import sqlite
|
||||
except ImportError:
|
||||
sqlite = None
|
||||
|
||||
|
||||
if sqlite is not None:
|
||||
class NewsTestCase(ChannelPluginTestCase):
|
||||
plugins = ('News',)
|
||||
def testAddNews(self):
|
||||
self.assertNotError('addnews #somechannel 0 subject: foo')
|
||||
self.assertNotError('addnews 0 subject2: foo2')
|
||||
|
||||
def testListNews(self):
|
||||
# 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:
|
||||
|
||||
|
@ -34,31 +34,37 @@ from test import *
|
||||
import utils
|
||||
import ircdb
|
||||
|
||||
class NotesTestCase(PluginTestCase, PluginDocumentation):
|
||||
plugins = ('Notes', 'MiscCommands', 'UserCommands')
|
||||
def testHelps(self):
|
||||
self.assertNotError('help sendnote')
|
||||
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')
|
||||
try:
|
||||
import sqlite
|
||||
except ImportError:
|
||||
sqlite = None
|
||||
|
||||
def testNotes(self):
|
||||
self.assertNotError('notes')
|
||||
if sqlite is not None:
|
||||
class NotesTestCase(PluginTestCase, PluginDocumentation):
|
||||
plugins = ('Notes', 'MiscCommands', 'UserCommands')
|
||||
def testHelps(self):
|
||||
self.assertNotError('help sendnote')
|
||||
self.assertNotError('list Notes')
|
||||
|
||||
def testOldNotes(self):
|
||||
self.assertNotError('oldnotes')
|
||||
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):
|
||||
self.assertNotError('notes')
|
||||
|
||||
def testOldNotes(self):
|
||||
self.assertNotError('oldnotes')
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
@ -31,38 +31,44 @@
|
||||
|
||||
from test import *
|
||||
|
||||
class QuotesTestCase(PluginTestCase, PluginDocumentation):
|
||||
plugins = ('Quotes',)
|
||||
def test(self):
|
||||
self.assertRegexp('numquotes #foo', '0')
|
||||
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.assertRegexp('addquote #foo bar','Quote #2 added')
|
||||
self.assertResponse('quote #foo 2', '#2: bar')
|
||||
self.assertResponse('quote #foo --id 2', '#2: bar')
|
||||
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')
|
||||
self.assertRegexp('quote #foo --regexp ba', 'bar.*baz')
|
||||
self.assertRegexp('quote #foo --with bar', '#2: bar')
|
||||
self.assertRegexp('quote #foo bar', '#2: bar')
|
||||
self.assertNotError('quoteinfo #foo 1')
|
||||
self.assertNotError('randomquote #foo')
|
||||
self.assertError('removequote #foo 4')
|
||||
self.assertError('quoteinfo #foo 4')
|
||||
self.assertNotError('removequote #foo 3')
|
||||
self.assertRegexp('numquotes #foo', '2')
|
||||
self.assertNotError('removequote #foo 1')
|
||||
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')
|
||||
try:
|
||||
import sqlite
|
||||
except ImportError:
|
||||
sqlite = None
|
||||
|
||||
if sqlite is not None:
|
||||
class QuotesTestCase(PluginTestCase, PluginDocumentation):
|
||||
plugins = ('Quotes',)
|
||||
def test(self):
|
||||
self.assertRegexp('numquotes #foo', '0')
|
||||
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.assertRegexp('addquote #foo bar','Quote #2 added')
|
||||
self.assertResponse('quote #foo 2', '#2: bar')
|
||||
self.assertResponse('quote #foo --id 2', '#2: bar')
|
||||
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')
|
||||
self.assertRegexp('quote #foo --regexp ba', 'bar.*baz')
|
||||
self.assertRegexp('quote #foo --with bar', '#2: bar')
|
||||
self.assertRegexp('quote #foo bar', '#2: bar')
|
||||
self.assertNotError('quoteinfo #foo 1')
|
||||
self.assertNotError('randomquote #foo')
|
||||
self.assertError('removequote #foo 4')
|
||||
self.assertError('quoteinfo #foo 4')
|
||||
self.assertNotError('removequote #foo 3')
|
||||
self.assertRegexp('numquotes #foo', '2')
|
||||
self.assertNotError('removequote #foo 1')
|
||||
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
|
||||
""".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.feedMsg(url)
|
||||
counter += 1
|
||||
self.assertNotError('geturl %s' % counter)
|
||||
self.assertRegexp('lasturl', re.escape(urls[-1]))
|
||||
self.assertRegexp('lasturl --proto https', re.escape(urls[-3]))
|
||||
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))
|
||||
self.assertRegexp('lasturl', re.escape(urls[-1]))
|
||||
self.assertRegexp('lasturl --proto https', re.escape(urls[-3]))
|
||||
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):
|
||||
self.feedMsg(urls[0])
|
||||
self.assertResponse('lasturl', urls[0])
|
||||
|
||||
def testDefaultNotFancy(self):
|
||||
self.feedMsg(urls[0])
|
||||
self.assertResponse('lasturl', urls[0])
|
||||
|
||||
def testAction(self):
|
||||
self.irc.feedMsg(ircmsgs.action(self.channel, urls[1]))
|
||||
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