Isup/NoTrigger/PassGen/PkgInfo: add unittests (#13)

This commit is contained in:
James Lu 2014-10-06 19:02:12 -07:00
parent 8242693446
commit 5c5ab2cf74
4 changed files with 45 additions and 2 deletions

View File

@ -33,5 +33,9 @@ from supybot.test import *
class IsupTestCase(PluginTestCase):
plugins = ('Isup',)
def testBasics(self):
self.assertRegexp('check google.com', "It's just you")
self.assertRegexp('check dhjeheiaoij', "invalid|url|error", re.I)
self.assertRegexp('check dhjeheiao.invalid', "invalid|url|error", re.I)
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:

View File

@ -30,8 +30,21 @@
from supybot.test import *
class NoTriggerTestCase(PluginTestCase):
plugins = ('NoTrigger',)
class NoTriggerTestCase(ChannelPluginTestCase):
plugins = ('NoTrigger','Utilities', 'Reply')
config = {'supybot.plugins.notrigger.enable': True,
'supybot.plugins.notrigger.spaceBeforeNicks': True,
'supybot.plugins.notrigger.blockCtcp': True}
def testSpaceBeforePrefixes(self):
self.assertResponse('echo !test', ' !test')
def testSpaceBeforeNicks(self):
self.assertResponse('echo example: hello', ' example: hello')
self.assertResponse('echo user1, hello', ' user1, hello')
def testCTCPBlocking(self):
self.assertResponse('echo \x01PING abcd\x01', 'PING abcd')
self.assertAction('reply action jumps around', 'jumps around')
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:

View File

@ -32,6 +32,12 @@ from supybot.test import *
class PassGenTestCase(PluginTestCase):
plugins = ('PassGen',)
config = {'supybot.plugins.passgen.maxLength': 30}
def testmaxLen(self):
self.assertError('mkpasswd 70')
def testBasics(self):
self.assertNotError('mkpasswd 20')
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:

View File

@ -32,6 +32,26 @@ from supybot.test import *
class PkgInfoTestCase(PluginTestCase):
plugins = ('PkgInfo',)
def testPackageCommandBasics(self):
self.assertRegexp('package sid bash', 'Package: .*?bash'
' .*?; View more at: http://packages.debian.org/sid/bash')
self.assertRegexp('package trusty apt', 'Package: .*?apt'
' .*?; View more at: http://packages.ubuntu.com/trusty/apt')
self.assertError('package afdsfsadf asfasfasf')
self.assertRegexp('package sid afsadfasfsa', 'no such package', re.I)
def testVlistCommandBasics(self):
self.assertError('vlist all afdsafas')
self.assertError('vlist invalid-distro firefox')
self.assertNotError('vlist debian bash')
def testArchpkg(self):
self.assertError('archpkg afdsfbjeiog')
self.assertNotError('archpkg bash')
self.assertRegexp('archpkg pacman --exact', 'Found 1.*?pacman -.*?')
def testArchaur(self):
self.assertError('archaur wjoitgjwotgjv')
self.assertNotError('archaur yaourt')
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: