Updated tests to make them all work properly now... (finally)

This commit is contained in:
Kevin Murphy 2004-12-30 08:34:18 +00:00
parent ea5bc4d5ca
commit 9246b169e1

View File

@ -50,6 +50,7 @@ class ShrinkUrlTestCase(ChannelPluginTestCase):
def testTinysnarf(self): def testTinysnarf(self):
try: try:
conf.supybot.snarfThrottle.setValue(1)
conf.supybot.plugins.ShrinkUrl.default.setValue('tiny') conf.supybot.plugins.ShrinkUrl.default.setValue('tiny')
conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True) conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True)
self.assertSnarfRegexp( self.assertSnarfRegexp(
@ -69,28 +70,29 @@ class ShrinkUrlTestCase(ChannelPluginTestCase):
self.assertRegexp( self.assertRegexp(
'shrinkurl ln http://sourceforge.net/tracker/?' 'shrinkurl ln http://sourceforge.net/tracker/?'
'func=add&group_id=58965&atid=489447', 'func=add&group_id=58965&atid=489447',
r'http://ln-s.net/1Es') r'http://ln-s.net/25Z')
conf.supybot.plugins.ShrinkUrl.default.setValue('ln') conf.supybot.plugins.ShrinkUrl.default.setValue('ln')
conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True) conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True)
self.assertRegexp( self.assertRegexp(
'shrinkurl ln http://sourceforge.net/tracker/?' 'shrinkurl ln http://sourceforge.net/tracker/?'
'func=add&group_id=58965&atid=489447', 'func=add&group_id=58965&atid=489447',
r'http://ln-s.net/1Es') r'http://ln-s.net/25Z')
finally: finally:
conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(False) conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(False)
def testLnsnarf(self): def testLnsnarf(self):
try: try:
conf.supybot.snarfThrottle.setValue(1)
conf.supybot.plugins.ShrinkUrl.default.setValue('ln') conf.supybot.plugins.ShrinkUrl.default.setValue('ln')
conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True) conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True)
self.assertSnarfRegexp( self.assertSnarfRegexp(
'http://sourceforge.net/tracker/?func=add&' 'http://sourceforge.net/tracker/?func=add&'
'group_id=58965&atid=489447', 'group_id=58965&atid=489447',
r'http://ln-s.net/1Es.* \(at') r'http://ln-s.net/25Z.* \(at')
self.assertSnarfRegexp( self.assertSnarfRegexp(
'http://www.urbandictionary.com/define.php?' 'http://www.urbandictionary.com/define.php?'
'term=all+your+base+are+belong+to+us', 'term=all+your+base+are+belong+to+us',
r'http://ln-s.net/1Eu.* \(at') r'http://ln-s.net/2\$K.* \(at')
finally: finally:
conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(False) conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(False)
@ -98,13 +100,15 @@ class ShrinkUrlTestCase(ChannelPluginTestCase):
tiny = conf.supybot.plugins.ShrinkUrl.shrinkSnarfer() tiny = conf.supybot.plugins.ShrinkUrl.shrinkSnarfer()
snarf = conf.supybot.plugins.ShrinkUrl.nonSnarfingRegexp() snarf = conf.supybot.plugins.ShrinkUrl.nonSnarfingRegexp()
try: try:
conf.supybot.snarfThrottle.setValue(1)
conf.supybot.plugins.ShrinkUrl.default.setValue('tiny') conf.supybot.plugins.ShrinkUrl.default.setValue('tiny')
conf.supybot.plugins.ShrinkUrl.nonSnarfingRegexp.set('m/sf/') conf.supybot.plugins.ShrinkUrl.nonSnarfingRegexp.set('m/sf/')
conf.supybot.plugins.ShrinkUrl.minimumLength.setValue(10)
try: try:
conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True) conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True)
self.assertSnarfNoResponse('http://sf.net/', 2) self.assertSnarfNoResponse('http://sf.net/', 2)
self.assertSnarfResponse('http://www.sourceforge.net/', self.assertSnarfRegexp('http://sourceforge.net/',
'http://tinyurl.com/2cnkf') r'http://tinyurl.com/7vm7.* \(at')
finally: finally:
conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(tiny) conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(tiny)
finally: finally: