Modified the snarfer so that it recognizes sf.net URLs. Also updated the tests

to check that functionality.
This commit is contained in:
James Vega 2003-10-21 12:37:04 +00:00
parent e4909c5f42
commit 71c79417e1
2 changed files with 8 additions and 1 deletions

View File

@ -243,7 +243,7 @@ class Sf(callbacks.PrivmsgCommandAndRegexp):
_sfTitle = re.compile(r'Detail:(\d+) - ([^<]+)</title>', re.I)
_linkType = re.compile(r'(\w+ \w+|\w+): Tracker Detailed View', re.I)
def sfSnarfer(self, irc, msg, match):
r"https?://(?:www\.)?sourceforge\.net/tracker/(?:index\.php)?\?func=detail&aid=\d+&group_id=\d+&atid=\d+"
r"https?://(?:www\.)?(?:sourceforge|sf)\.net/tracker/(?:index\.php)?\?func=detail&aid=\d+&group_id=\d+&atid=\d+"
if not self.snarfer:
return
url = match.group(0)

View File

@ -73,6 +73,9 @@ class SfTest(PluginTestCase, PluginDocumentation):
# test that it works with www and without index.php
self.assertNotError('http://www.sourceforge.net/tracker/?'\
'func=detail&aid=540223&group_id=235&atid=300235')
# test that it works with sf.net
self.assertNotError('http://sf.net/tracker/?'\
'func=detail&aid=540223&group_id=235&atid=300235')
def testHttpsSnarfer(self):
s = r';.*Status.*: \w+;'
@ -86,6 +89,7 @@ class SfTest(PluginTestCase, PluginDocumentation):
'func=detail&aid=561547&group_id=235&atid=200235', s)
self.assertRegexp('http://sourceforge.net/tracker/index.php?'\
'func=detail&aid=400942&group_id=235&atid=390395', s)
# test that it works without index.php
self.assertNotError('https://sourceforge.net/tracker/?'\
'func=detail&aid=540223&group_id=235&atid=300235')
@ -95,6 +99,9 @@ class SfTest(PluginTestCase, PluginDocumentation):
# test that it works with www and without index.php
self.assertNotError('https://www.sourceforge.net/tracker/index.php?'\
'func=detail&aid=540223&group_id=235&atid=300235')
# test that it works with www and without index.php
self.assertNotError('https://sf.net/tracker/index.php?'\
'func=detail&aid=540223&group_id=235&atid=300235')
def testDisablesfsnarfer(self):
self.assertRegexp('http://sourceforge.net/tracker/index.php?'\