mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-25 19:44:13 +01:00
Modified the snarfer so that it recognizes sf.net URLs. Also updated the tests
to check that functionality.
This commit is contained in:
parent
e4909c5f42
commit
71c79417e1
@ -243,7 +243,7 @@ class Sf(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\.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:
|
if not self.snarfer:
|
||||||
return
|
return
|
||||||
url = match.group(0)
|
url = match.group(0)
|
||||||
|
@ -73,6 +73,9 @@ class SfTest(PluginTestCase, PluginDocumentation):
|
|||||||
# test that it works with www and without index.php
|
# test that it works with www and without index.php
|
||||||
self.assertNotError('http://www.sourceforge.net/tracker/?'\
|
self.assertNotError('http://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 sf.net
|
||||||
|
self.assertNotError('http://sf.net/tracker/?'\
|
||||||
|
'func=detail&aid=540223&group_id=235&atid=300235')
|
||||||
|
|
||||||
def testHttpsSnarfer(self):
|
def testHttpsSnarfer(self):
|
||||||
s = r';.*Status.*: \w+;'
|
s = r';.*Status.*: \w+;'
|
||||||
@ -86,6 +89,7 @@ class SfTest(PluginTestCase, PluginDocumentation):
|
|||||||
'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')
|
||||||
@ -95,6 +99,9 @@ class SfTest(PluginTestCase, PluginDocumentation):
|
|||||||
# 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
|
||||||
|
self.assertNotError('https://sf.net/tracker/index.php?'\
|
||||||
|
'func=detail&aid=540223&group_id=235&atid=300235')
|
||||||
|
|
||||||
def testDisablesfsnarfer(self):
|
def testDisablesfsnarfer(self):
|
||||||
self.assertRegexp('http://sourceforge.net/tracker/index.php?'\
|
self.assertRegexp('http://sourceforge.net/tracker/index.php?'\
|
||||||
|
Loading…
Reference in New Issue
Block a user