mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Change project registry value to defaultProject.
This commit is contained in:
parent
abd4eeddf0
commit
2a586bdb78
@ -72,7 +72,7 @@ def configure(advanced):
|
||||
if yn('Do you want to specify a default project?'):
|
||||
project = anything('Project name:')
|
||||
if project:
|
||||
conf.supybot.plugins.Sourceforge.project.set(project)
|
||||
conf.supybot.plugins.Sourceforge.defaultProject.set(project)
|
||||
|
||||
output("""Sourceforge is quite the word to type, and it may get annoying
|
||||
typing it all the time because Supybot makes you use the plugin
|
||||
@ -101,7 +101,7 @@ conf.registerPlugin('Sourceforge')
|
||||
conf.registerChannelValue(conf.supybot.plugins.Sourceforge, 'trackerSnarfer',
|
||||
registry.Boolean(False, """Determines whether the bot will reply to SF.net
|
||||
Tracker URLs in the channel with a nice summary of the tracker item."""))
|
||||
conf.registerChannelValue(conf.supybot.plugins.Sourceforge, 'project',
|
||||
conf.registerChannelValue(conf.supybot.plugins.Sourceforge, 'defaultProject',
|
||||
registry.String('', """Sets the default project to use in the case that no
|
||||
explicit project is given."""))
|
||||
|
||||
@ -204,7 +204,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
||||
except ValueError:
|
||||
pass
|
||||
if not project:
|
||||
project = self.registryValue('project', msg.args[0])
|
||||
project = self.registryValue('defaultProject', msg.args[0])
|
||||
if not project:
|
||||
raise callbacks.ArgumentError
|
||||
try:
|
||||
@ -224,7 +224,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
||||
default project is set.
|
||||
"""
|
||||
project = privmsgs.getArgs(args, required=0, optional=1)
|
||||
project = project or self.registryValue('project', msg.args[0])
|
||||
project = project or self.registryValue('defaultProject', msg.args[0])
|
||||
if not project:
|
||||
raise callbacks.ArgumentError
|
||||
text = webutils.getUrl(''.join([self._projectURL, project]))
|
||||
@ -255,7 +255,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
||||
irc.error('"%s" is not a proper bugnumber.' % project)
|
||||
return
|
||||
bugnum = project
|
||||
project = self.registryValue('project', msg.args[0])
|
||||
project = self.registryValue('defaultProject', msg.args[0])
|
||||
if not project:
|
||||
raise callbacks.ArgumentError
|
||||
try:
|
||||
@ -290,7 +290,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
||||
except ValueError:
|
||||
pass
|
||||
if not project:
|
||||
project = self.registryValue('project', msg.args[0])
|
||||
project = self.registryValue('defaultProject', msg.args[0])
|
||||
if not project:
|
||||
raise callbacks.ArgumentError
|
||||
try:
|
||||
@ -309,7 +309,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
||||
default project is set.
|
||||
"""
|
||||
project = privmsgs.getArgs(args, required=0, optional=1)
|
||||
project = project or self.registryValue('project', msg.args[0])
|
||||
project = project or self.registryValue('defaultProject', msg.args[0])
|
||||
if not project:
|
||||
raise callbacks.ArgumentError
|
||||
text = webutils.getUrl(''.join([self._projectURL, project]))
|
||||
@ -340,7 +340,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
||||
irc.error('"%s" is not a proper rfenumber.' % project)
|
||||
return
|
||||
rfenum = project
|
||||
project = self.registryValue('project', msg.args[0])
|
||||
project = self.registryValue('defaultProject', msg.args[0])
|
||||
if not project:
|
||||
raise callbacks.ArgumentError
|
||||
try:
|
||||
|
@ -85,28 +85,17 @@ if network:
|
||||
n = re.search('#(\d+)', m.args[1]).group(1)
|
||||
self.assertNotError('rfe --open gaim %s' % n)
|
||||
|
||||
"""
|
||||
Just assume pending works since we're not 99% guaranteed to have a
|
||||
project that has pending bugs/rfes like we do with the others.
|
||||
def testPending(self):
|
||||
m = self.getMsg('bugs --pending gaim')
|
||||
self.failUnless(m, 'No response from Sourceforge.')
|
||||
n = re.search('#(\d+)', m.args[1]).group(1)
|
||||
self.assertNotError('bug --pending gaim %s' % n)
|
||||
m = self.getMsg('rfes --pending gaim')
|
||||
self.failUnless(m, 'No response from Sourceforge.')
|
||||
n = re.search('#(\d+)', m.args[1]).group(1)
|
||||
self.assertNotError('rfe --pending gaim %s' % n)
|
||||
"""
|
||||
|
||||
def testBugs(self):
|
||||
self.assertHelp('bugs')
|
||||
conf.supybot.plugins.Sourceforge.project.set('supybot')
|
||||
self.assertNotError('bugs')
|
||||
self.assertRegexp('bugs alkjfi83fa8', 'find the Bugs')
|
||||
self.assertNotError('bugs gaim')
|
||||
conf.supybot.plugins.Sourceforge.project.set('')
|
||||
self.assertRegexp('bugs 83423', 'Use the bug command')
|
||||
try:
|
||||
original = conf.supybot.plugins.Sourceforge.defaultProject()
|
||||
conf.supybot.plugins.Sourceforge.defaultProject.set('supybot')
|
||||
self.assertRegexp('bugs alkjfi83fa8', 'find the Bugs')
|
||||
self.assertNotError('bugs gaim')
|
||||
self.assertNotError('bugs')
|
||||
finally:
|
||||
conf.supybot.plugins.Sourceforge.defaultProject.set(original)
|
||||
|
||||
def testRfe(self):
|
||||
m = self.getMsg('rfes gaim')
|
||||
@ -118,18 +107,21 @@ if network:
|
||||
|
||||
def testRfes(self):
|
||||
self.assertHelp('rfes')
|
||||
conf.supybot.plugins.Sourceforge.project.set('gaim')
|
||||
self.assertNotError('rfes')
|
||||
self.assertRegexp('rfes alkjfi83hfa8', 'find the RFEs')
|
||||
self.assertNotError('rfes gaim')
|
||||
conf.supybot.plugins.Sourceforge.project.set('')
|
||||
self.assertRegexp('rfes 83423', 'Use the rfe command')
|
||||
try:
|
||||
original = conf.supybot.plugins.Sourceforge.defaultProject()
|
||||
conf.supybot.plugins.Sourceforge.defaultProject.set('gaim')
|
||||
self.assertNotError('rfes')
|
||||
self.assertRegexp('rfes alkjfi83hfa8', 'find the RFEs')
|
||||
self.assertNotError('rfes gaim')
|
||||
finally:
|
||||
conf.supybot.plugins.Sourceforge.defaultProject.set(original)
|
||||
|
||||
def testDefaultproject(self):
|
||||
self.assertHelp('bugs')
|
||||
try:
|
||||
original = conf.supybot.plugins.Sourceforge.project()
|
||||
conf.supybot.plugins.Sourceforge.project.set('supybot')
|
||||
original = conf.supybot.plugins.Sourceforge.defaultProject()
|
||||
conf.supybot.plugins.Sourceforge.defaultProject.set('supybot')
|
||||
self.assertNotError('bugs')
|
||||
m = self.getMsg('bugs')
|
||||
n = re.search('#(\d+)', m.args[1]).group(1)
|
||||
@ -137,54 +129,59 @@ if network:
|
||||
# This should have the same effect as calling 'bug supybot %s'
|
||||
self.assertNotError('bug %s' % n)
|
||||
finally:
|
||||
conf.supybot.plugins.Sourceforge.project.set(original)
|
||||
conf.supybot.plugins.Sourceforge.defaultProject.set(original)
|
||||
|
||||
def testSnarfer(self):
|
||||
s = r'.*Status.*: \w+'
|
||||
conf.supybot.plugins.Sourceforge.trackerSnarfer.setValue(True)
|
||||
self.assertRegexp('http://sourceforge.net/tracker/index.php?'
|
||||
'func=detail&aid=589953&group_id=58965&'
|
||||
'atid=489447',
|
||||
s)
|
||||
self.assertRegexp('http://sourceforge.net/tracker/index.php?'
|
||||
'func=detail&aid=712761&group_id=58965&'
|
||||
'atid=489450',
|
||||
s)
|
||||
self.assertRegexp('http://sourceforge.net/tracker/index.php?'
|
||||
'func=detail&aid=540223&group_id=235&'
|
||||
'atid=300235',
|
||||
s)
|
||||
self.assertRegexp('http://sourceforge.net/tracker/index.php?'
|
||||
'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('http://sourceforge.net/tracker/?'
|
||||
'func=detail&aid=540223&group_id=235&'
|
||||
'atid=300235')
|
||||
# test that it works with www
|
||||
self.assertNotError('http://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('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')
|
||||
# test that it works
|
||||
self.assertNotError('https://sourceforge.net/tracker/?'
|
||||
'func=detail&atid=105470&aid=827260&'
|
||||
'group_id=5470')
|
||||
self.assertNoResponse('https://sourceforge.net/tracker/?'
|
||||
'group_id=58965&atid=489447')
|
||||
try:
|
||||
original = conf.supybot.plugins.Sourceforge.trackerSnarfer()
|
||||
conf.supybot.plugins.Sourceforge.trackerSnarfer.setValue(True)
|
||||
self.assertRegexp('http://sourceforge.net/tracker/index.php?'
|
||||
'func=detail&aid=589953&group_id=58965&'
|
||||
'atid=489447',
|
||||
s)
|
||||
self.assertRegexp('http://sourceforge.net/tracker/index.php?'
|
||||
'func=detail&aid=712761&group_id=58965&'
|
||||
'atid=489450',
|
||||
s)
|
||||
self.assertRegexp('http://sourceforge.net/tracker/index.php?'
|
||||
'func=detail&aid=540223&group_id=235&'
|
||||
'atid=300235',
|
||||
s)
|
||||
self.assertRegexp('http://sourceforge.net/tracker/index.php?'
|
||||
'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('http://sourceforge.net/tracker/?'
|
||||
'func=detail&aid=540223&group_id=235&'
|
||||
'atid=300235')
|
||||
# test that it works with www
|
||||
self.assertNotError('http://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('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')
|
||||
# test that it works
|
||||
self.assertNotError('https://sourceforge.net/tracker/?'
|
||||
'func=detail&atid=105470&aid=827260&'
|
||||
'group_id=5470')
|
||||
self.assertNoResponse('https://sourceforge.net/tracker/?'
|
||||
'group_id=58965&atid=489447')
|
||||
finally:
|
||||
conf.supybot.plugins.Sourceforge.trackerSnarfer.setValue(
|
||||
original)
|
||||
|
||||
def testTotal(self):
|
||||
self.assertRegexp('totalbugs gaim', r'\d+ open / \d+ total')
|
||||
|
Loading…
Reference in New Issue
Block a user