mirror of https://github.com/Mikaela/Limnoria.git
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:
|
||||||
self.assertNoResponse('http://biff.bar.baz/', 2)
|
conf.supybot.plugins.URL.nonSnarfingRegexp.set('m/biff/i')
|
||||||
self.assertResponse('url last', 'http://foo.bar.baz/')
|
self.assertNoResponse('http://biff.bar.baz/', 2)
|
||||||
|
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)
|
||||||
'func=add&group_id=58965&atid=489447',
|
self.assertRegexp(
|
||||||
r'http://tinyurl.com/rqac')
|
'url tiny http://sourceforge.net/tracker/?'
|
||||||
self.assertNotError('url config tinyurlsnarfer on')
|
'func=add&group_id=58965&atid=489447',
|
||||||
self.assertRegexp('url tiny http://sourceforge.net/tracker/?'
|
r'http://tinyurl.com/rqac')
|
||||||
'func=add&group_id=58965&atid=489447',
|
conf.supybot.plugins.URL.tinyurlSnarfer.setValue(True)
|
||||||
r'http://tinyurl.com/rqac')
|
self.assertRegexp(
|
||||||
|
'url tiny http://sourceforge.net/tracker/?'
|
||||||
|
'func=add&group_id=58965&atid=489447',
|
||||||
|
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:
|
||||||
self.assertRegexp('http://sourceforge.net/tracker/?'
|
conf.supybot.plugins.URL.tinyurlSnarfer.setValue(True)
|
||||||
'func=add&group_id=58965&atid=489447',
|
self.assertRegexp('http://sourceforge.net/tracker/?'
|
||||||
r'http://tinyurl.com/rqac.* \(was')
|
'func=add&group_id=58965&atid=489447',
|
||||||
self.assertRegexp('http://www.urbandictionary.com/define.php?'
|
r'http://tinyurl.com/rqac.* \(was')
|
||||||
'term=all+your+base+are+belong+to+us',
|
self.assertRegexp(
|
||||||
r'http://tinyurl.com/u479.* \(was')
|
'http://www.urbandictionary.com/define.php?'
|
||||||
|
'term=all+your+base+are+belong+to+us',
|
||||||
|
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