Skip to content

Commit

Permalink
s/validate_master_option/validateMasterOption/
Browse files Browse the repository at this point in the history
  • Loading branch information
tomprince committed Apr 14, 2013
1 parent a9e3398 commit 39620ef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
15 changes: 8 additions & 7 deletions master/buildbot/scripts/runner.py
Expand Up @@ -30,8 +30,9 @@
# Note that the terms 'options' and 'config' are used interchangeably here - in
# fact, they are interchanged several times. Caveat legator.

def validate_master_option(master):
"""Validate master (-m, --master) command line option.
def validateMasterOption(master):
"""
Validate master (-m, --master) command line option.
Checks that option is a string of the 'hostname:port' form, otherwise
raises an UsageError exception.
Expand Down Expand Up @@ -214,7 +215,7 @@ def parseArgs(self, *args):

def postOptions(self):
base.SubcommandOptions.postOptions(self)
validate_master_option(self.get('master'))
validateMasterOption(self.get('master'))


class BaseStatusClientOptions(base.SubcommandOptions):
Expand All @@ -241,7 +242,7 @@ def parseArgs(self, *args):

def postOptions(self):
base.SubcommandOptions.postOptions(self)
validate_master_option(self.get('master'))
validateMasterOption(self.get('master'))



Expand Down Expand Up @@ -348,7 +349,7 @@ def postOptions(self):
if self.get('vc') and self.get('vc') not in vcs:
raise usage.UsageError("vc must be one of %s" % (', '.join(vcs)))

validate_master_option(self.get('master'))
validateMasterOption(self.get('master'))

class TryOptions(base.SubcommandOptions):
subcommandFunction = "buildbot.scripts.trycmd.trycmd"
Expand Down Expand Up @@ -493,7 +494,7 @@ def postOptions(self):
if not self['master']:
raise usage.UsageError("master location must be specified" \
"for 'pb' connections")
validate_master_option(self['master'])
validateMasterOption(self['master'])


class TryServerOptions(base.SubcommandOptions):
Expand Down Expand Up @@ -613,7 +614,7 @@ def _checkValidTypes(self, info):
def postOptions(self):
base.SubcommandOptions.postOptions(self)

validate_master_option(self.get('master'))
validateMasterOption(self.get('master'))

op = self.get('op')
if not op:
Expand Down
12 changes: 10 additions & 2 deletions master/buildbot/test/unit/test_scripts_runner.py
Expand Up @@ -549,10 +549,18 @@ def test_config_options(self):
buildbotbin='.virtualenvs/buildbot/bin/buildbot')
self.assertOptions(opts, exp)

def test_pb_no_master(self):
def test_pb_withNoMaster(self):
"""
When 'builbot try' is asked to connect via pb, but no master is
specified, a usage error is raised.
"""
self.assertRaises(usage.UsageError, self.parse, '--connect=pb')

def test_master_inval(self):
def test_pb_withInvalidMaster(self):
"""
When 'buildbot try' is asked to conncect via pb, but an invalid
master is specified, a usage error is raised.
"""
self.assertRaises(usage.UsageError, self.parse,
'--connect=pb', '--master=foo')

Expand Down

0 comments on commit 39620ef

Please sign in to comment.