Change project registry value to defaultProject.

This commit is contained in:
James Vega 2004-02-09 04:02:21 +00:00
parent abd4eeddf0
commit 2a586bdb78
2 changed files with 76 additions and 79 deletions

View File

@ -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:

View File

@ -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 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')
conf.supybot.plugins.Sourceforge.project.set('')
self.assertRegexp('bugs 83423', 'Use the bug command')
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.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')
conf.supybot.plugins.Sourceforge.project.set('')
self.assertRegexp('rfes 83423', 'Use the rfe command')
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,10 +129,12 @@ 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+'
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&'
@ -185,6 +179,9 @@ if network:
'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')