Fixed bug in tests; it was caused by the prefix character being snarfed in along with the URL.

This commit is contained in:
Jeremy Fincher 2003-11-10 23:24:19 +00:00
parent 8c10948d2e
commit 4cc9579582
2 changed files with 2 additions and 7 deletions

View File

@ -101,7 +101,7 @@ class URL(callbacks.Privmsg, plugins.Configurable, plugins.ChannelDBHandler):
db.commit()
return db
_urlRe = re.compile(r"([^\[<(\s]+://[^\])>\s]+)", re.I)
_urlRe = re.compile(r"(\w+://[^\])>\s]+)", re.I)
def doPrivmsg(self, irc, msg):
channel = msg.args[0]
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>')
def _getTinyUrl(self, url, cmd=False):
try:
#debug.printf('Trying to get tinyurl for %r' % url)
fd = urllib2.urlopen('http://tinyurl.com/create.php?url=%s' % url)
s = fd.read()
fd.close()

View File

@ -109,13 +109,7 @@ if sqlite is not None:
self.assertRegexp('url tiny http://sourceforge.net/tracker/?'
'func=add&group_id=58965&atid=489447',
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):
self.assertNotError('url config tinyurlsnarfer on')
self.assertRegexp('http://www.urbandictionary.com/define.php?'