mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 02:24:12 +01:00
Attempting to remove config stuff from tests.
This commit is contained in:
parent
67a97fd136
commit
009b3b494b
@ -74,8 +74,11 @@ except ImportError:
|
|||||||
if sqlite is not None:
|
if sqlite is not None:
|
||||||
class URLTestCase(ChannelPluginTestCase, PluginDocumentation):
|
class URLTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||||
plugins = ('URL',)
|
plugins = ('URL',)
|
||||||
|
def setUp(self):
|
||||||
|
conf.supybot.plugins.URL.tinyurlSnarfer.setValue(False)
|
||||||
|
ChannePluginTestCase.setUp(self)
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
self.assertNotError('config tinyurlsnarfer off')
|
|
||||||
counter = 0
|
counter = 0
|
||||||
self.assertNotError('url random')
|
self.assertNotError('url random')
|
||||||
for url in urls:
|
for url in urls:
|
||||||
@ -91,48 +94,60 @@ if sqlite is not None:
|
|||||||
self.assertNotError('url random')
|
self.assertNotError('url random')
|
||||||
|
|
||||||
def testDefaultNotFancy(self):
|
def testDefaultNotFancy(self):
|
||||||
self.assertNotError('url config tinyurlsnarfer off')
|
|
||||||
self.feedMsg(urls[0])
|
self.feedMsg(urls[0])
|
||||||
self.assertResponse('url last', urls[0])
|
self.assertResponse('url last', urls[0])
|
||||||
|
|
||||||
def testAction(self):
|
def testAction(self):
|
||||||
self.assertNotError('url config tinyurlsnarfer off')
|
|
||||||
self.irc.feedMsg(ircmsgs.action(self.channel, urls[1]))
|
self.irc.feedMsg(ircmsgs.action(self.channel, urls[1]))
|
||||||
self.assertNotRegexp('url last', '\\x01')
|
self.assertNotRegexp('url last', '\\x01')
|
||||||
|
|
||||||
def testNonSnarfingRegexpConfigurable(self):
|
def testNonSnarfingRegexpConfigurable(self):
|
||||||
self.assertNoResponse('http://foo.bar.baz/', 2)
|
self.assertNoResponse('http://foo.bar.baz/', 2)
|
||||||
self.assertResponse('url last', 'http://foo.bar.baz/')
|
self.assertResponse('url last', 'http://foo.bar.baz/')
|
||||||
self.assertNotError('url config non-snarfing-regexp m/biff/i')
|
try:
|
||||||
|
conf.supybot.plugins.URL.nonSnarfingRegexp.set('m/biff/i')
|
||||||
self.assertNoResponse('http://biff.bar.baz/', 2)
|
self.assertNoResponse('http://biff.bar.baz/', 2)
|
||||||
self.assertResponse('url last', 'http://foo.bar.baz/')
|
self.assertResponse('url last', 'http://foo.bar.baz/')
|
||||||
|
finally:
|
||||||
|
conf.supybot.plugins.URL.nonSnarfingRegexp.set('')
|
||||||
|
|
||||||
if network:
|
if network:
|
||||||
def testTinyurl(self):
|
def testTinyurl(self):
|
||||||
self.assertNotError('url config tinyurlsnarfer off')
|
try:
|
||||||
self.assertRegexp('url tiny http://sourceforge.net/tracker/?'
|
conf.supybot.plugins.URL.tinyurlSnarfer.setValue(False)
|
||||||
|
self.assertRegexp(
|
||||||
|
'url tiny http://sourceforge.net/tracker/?'
|
||||||
'func=add&group_id=58965&atid=489447',
|
'func=add&group_id=58965&atid=489447',
|
||||||
r'http://tinyurl.com/rqac')
|
r'http://tinyurl.com/rqac')
|
||||||
self.assertNotError('url config tinyurlsnarfer on')
|
conf.supybot.plugins.URL.tinyurlSnarfer.setValue(True)
|
||||||
self.assertRegexp('url tiny http://sourceforge.net/tracker/?'
|
self.assertRegexp(
|
||||||
|
'url tiny http://sourceforge.net/tracker/?'
|
||||||
'func=add&group_id=58965&atid=489447',
|
'func=add&group_id=58965&atid=489447',
|
||||||
r'http://tinyurl.com/rqac')
|
r'http://tinyurl.com/rqac')
|
||||||
|
finally:
|
||||||
|
conf.supybot.plugins.URL.tinyurlSnarfer.setValue(False)
|
||||||
|
|
||||||
def testTinysnarf(self):
|
def testTinysnarf(self):
|
||||||
self.assertNotError('url config tinyurlsnarfer on')
|
try:
|
||||||
|
conf.supybot.plugins.URL.tinyurlSnarfer.setValue(True)
|
||||||
self.assertRegexp('http://sourceforge.net/tracker/?'
|
self.assertRegexp('http://sourceforge.net/tracker/?'
|
||||||
'func=add&group_id=58965&atid=489447',
|
'func=add&group_id=58965&atid=489447',
|
||||||
r'http://tinyurl.com/rqac.* \(was')
|
r'http://tinyurl.com/rqac.* \(was')
|
||||||
self.assertRegexp('http://www.urbandictionary.com/define.php?'
|
self.assertRegexp(
|
||||||
|
'http://www.urbandictionary.com/define.php?'
|
||||||
'term=all+your+base+are+belong+to+us',
|
'term=all+your+base+are+belong+to+us',
|
||||||
r'http://tinyurl.com/u479.* \(was')
|
r'http://tinyurl.com/u479.* \(was')
|
||||||
|
finally:
|
||||||
|
conf.supybot.plugins.URL.tinyurlSnarfer.setValue(False)
|
||||||
|
|
||||||
def testTitleSnarfer(self):
|
def testTitleSnarfer(self):
|
||||||
self.assertNotError('url config titlesnarferincludesurl off')
|
try:
|
||||||
self.assertNoResponse('http://microsoft.com/')
|
conf.supybot.plugins.URL.titleSnarfer.setValue(True)
|
||||||
self.assertNotError('url config title-snarfer on')
|
|
||||||
self.assertResponse('http://microsoft.com/',
|
self.assertResponse('http://microsoft.com/',
|
||||||
'Title: Microsoft Corporation')
|
'Title: Microsoft Corporation')
|
||||||
|
finally:
|
||||||
|
conf.supybot.plugins.URL.titleSnarfer.setValue(False)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
Loading…
Reference in New Issue
Block a user