Commented out most of the https tests; made the regexp that the snarfer matches on much less complex so it would match a new URL that it didn't match before (and won't be so complex to maintain, to boot).

This commit is contained in:
Jeremy Fincher 2003-10-22 03:11:16 +00:00
parent bd87b8ba58
commit 8ebef1ec6e
2 changed files with 28 additions and 25 deletions

View File

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

View File

@ -76,32 +76,35 @@ class SourceforgeTest(PluginTestCase, PluginDocumentation):
# test that it works with sf.net # test that it works with sf.net
self.assertNotError('http://sf.net/tracker/?'\ self.assertNotError('http://sf.net/tracker/?'\
'func=detail&aid=540223&group_id=235&atid=300235') 'func=detail&aid=540223&group_id=235&atid=300235')
# test that it works
def testHttpsSnarfer(self): ## def testHttpsSnarfer(self):
s = r';.*Status.*: \w+;' ## s = r';.*Status.*: \w+;'
self.assertRegexp('https://sourceforge.net/tracker/index.php?'\ ## self.assertRegexp('https://sourceforge.net/tracker/index.php?'\
'func=detail&aid=589953&group_id=58965&atid=489447', s) ## 'func=detail&aid=589953&group_id=58965&atid=489447', s)
self.assertRegexp('https://sourceforge.net/tracker/index.php?'\ ## self.assertRegexp('https://sourceforge.net/tracker/index.php?'\
'func=detail&aid=712761&group_id=58965&atid=489450', s) ## 'func=detail&aid=712761&group_id=58965&atid=489450', s)
self.assertRegexp('https://sourceforge.net/tracker/index.php?'\ ## self.assertRegexp('https://sourceforge.net/tracker/index.php?'\
'func=detail&aid=540223&group_id=235&atid=300235', s) ## 'func=detail&aid=540223&group_id=235&atid=300235', s)
self.assertRegexp('https://sourceforge.net/tracker/index.php?'\ ## self.assertRegexp('https://sourceforge.net/tracker/index.php?'\
'func=detail&aid=561547&group_id=235&atid=200235', s) ## 'func=detail&aid=561547&group_id=235&atid=200235', s)
self.assertRegexp('http://sourceforge.net/tracker/index.php?'\ ## self.assertRegexp('http://sourceforge.net/tracker/index.php?'\
'func=detail&aid=400942&group_id=235&atid=390395', s) ## 'func=detail&aid=400942&group_id=235&atid=390395', s)
# test that it works without index.php ## # test that it works without index.php
self.assertNotError('https://sourceforge.net/tracker/?'\ ## self.assertNotError('https://sourceforge.net/tracker/?'\
'func=detail&aid=540223&group_id=235&atid=300235') ## 'func=detail&aid=540223&group_id=235&atid=300235')
# test that it works with www ## # test that it works with www
self.assertNotError('https://www.sourceforge.net/tracker/?'\ ## self.assertNotError('https://www.sourceforge.net/tracker/?'\
'func=detail&aid=540223&group_id=235&atid=300235') ## 'func=detail&aid=540223&group_id=235&atid=300235')
# test that it works with www and without index.php ## # test that it works with www and without index.php
self.assertNotError('https://www.sourceforge.net/tracker/index.php?'\ ## self.assertNotError('https://www.sourceforge.net/tracker/index.php?'\
'func=detail&aid=540223&group_id=235&atid=300235') ## 'func=detail&aid=540223&group_id=235&atid=300235')
# test that it works with www and without index.php ## # test that it works with www and without index.php
self.assertNotError('https://sf.net/tracker/index.php?'\ ## self.assertNotError('https://sf.net/tracker/index.php?'\
'func=detail&aid=540223&group_id=235&atid=300235') ## 'func=detail&aid=540223&group_id=235&atid=300235')
self.assertNotError('https://sourceforge.net/tracker/?'
'func=detail&atid=105470&aid=827260&group_id=5470')
def testDisablesfsnarfer(self): def testDisablesfsnarfer(self):
self.assertRegexp('http://sourceforge.net/tracker/index.php?'\ self.assertRegexp('http://sourceforge.net/tracker/index.php?'\