mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Fixed bug in tests; it was caused by the prefix character being snarfed in along with the URL.
This commit is contained in:
parent
8c10948d2e
commit
4cc9579582
@ -101,7 +101,7 @@ class URL(callbacks.Privmsg, plugins.Configurable, plugins.ChannelDBHandler):
|
|||||||
db.commit()
|
db.commit()
|
||||||
return db
|
return db
|
||||||
|
|
||||||
_urlRe = re.compile(r"([^\[<(\s]+://[^\])>\s]+)", re.I)
|
_urlRe = re.compile(r"(\w+://[^\])>\s]+)", re.I)
|
||||||
def doPrivmsg(self, irc, msg):
|
def doPrivmsg(self, irc, msg):
|
||||||
channel = msg.args[0]
|
channel = msg.args[0]
|
||||||
db = self.getDb(channel)
|
db = self.getDb(channel)
|
||||||
@ -153,6 +153,7 @@ class URL(callbacks.Privmsg, plugins.Configurable, plugins.ChannelDBHandler):
|
|||||||
_tinyRe = re.compile(r'(http://tinyurl.com/\w{4})</blockquote>')
|
_tinyRe = re.compile(r'(http://tinyurl.com/\w{4})</blockquote>')
|
||||||
def _getTinyUrl(self, url, cmd=False):
|
def _getTinyUrl(self, url, cmd=False):
|
||||||
try:
|
try:
|
||||||
|
#debug.printf('Trying to get tinyurl for %r' % url)
|
||||||
fd = urllib2.urlopen('http://tinyurl.com/create.php?url=%s' % url)
|
fd = urllib2.urlopen('http://tinyurl.com/create.php?url=%s' % url)
|
||||||
s = fd.read()
|
s = fd.read()
|
||||||
fd.close()
|
fd.close()
|
||||||
|
@ -109,13 +109,7 @@ if sqlite is not None:
|
|||||||
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')
|
||||||
self.assertRegexp('url tiny http://sourceforge.net/tracker/?'
|
|
||||||
'func=add&group_id=58965&atid=489447',
|
|
||||||
r'http://tinyurl.com/rqac')
|
|
||||||
|
|
||||||
|
|
||||||
class URLTestCase2(ChannelPluginTestCase, PluginDocumentation):
|
|
||||||
plugins = ('URL',)
|
|
||||||
def testTinysnarf(self):
|
def testTinysnarf(self):
|
||||||
self.assertNotError('url config tinyurlsnarfer on')
|
self.assertNotError('url config tinyurlsnarfer on')
|
||||||
self.assertRegexp('http://www.urbandictionary.com/define.php?'
|
self.assertRegexp('http://www.urbandictionary.com/define.php?'
|
||||||
|
Loading…
Reference in New Issue
Block a user