mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-05-07 12:03:43 -05:00
Isup/NoTrigger/PassGen/PkgInfo: add unittests (#13)
This commit is contained in:
parent
8242693446
commit
5c5ab2cf74
@ -33,5 +33,9 @@ from supybot.test import *
|
|||||||
class IsupTestCase(PluginTestCase):
|
class IsupTestCase(PluginTestCase):
|
||||||
plugins = ('Isup',)
|
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:
|
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||||
|
@ -30,8 +30,21 @@
|
|||||||
|
|
||||||
from supybot.test import *
|
from supybot.test import *
|
||||||
|
|
||||||
class NoTriggerTestCase(PluginTestCase):
|
class NoTriggerTestCase(ChannelPluginTestCase):
|
||||||
plugins = ('NoTrigger',)
|
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:
|
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||||
|
@ -32,6 +32,12 @@ from supybot.test import *
|
|||||||
|
|
||||||
class PassGenTestCase(PluginTestCase):
|
class PassGenTestCase(PluginTestCase):
|
||||||
plugins = ('PassGen',)
|
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:
|
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||||
|
@ -32,6 +32,26 @@ from supybot.test import *
|
|||||||
|
|
||||||
class PkgInfoTestCase(PluginTestCase):
|
class PkgInfoTestCase(PluginTestCase):
|
||||||
plugins = ('PkgInfo',)
|
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:
|
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user