Rename Builder.delete_job to Builder.delete_jobs.
Change-Id: If57a98a00e9577fdf7a3d7585905a2102d8c61cd
This commit is contained in:
parent
1fe7709923
commit
2236a00c53
@ -252,7 +252,7 @@ class Builder(object):
|
||||
if self.jenkins.is_managed(job['name']):
|
||||
logger.info("Removing obsolete jenkins job {0}"
|
||||
.format(job['name']))
|
||||
self.delete_job([job['name']])
|
||||
self.jenkins.delete_job(job['name'])
|
||||
deleted_jobs += 1
|
||||
else:
|
||||
logger.info("Not deleting unmanaged jenkins job %s",
|
||||
@ -261,7 +261,7 @@ class Builder(object):
|
||||
logger.debug("Keeping job %s", job['name'])
|
||||
return deleted_jobs
|
||||
|
||||
def delete_job(self, jobs):
|
||||
def delete_jobs(self, jobs):
|
||||
if jobs is not None:
|
||||
logger.info("Removing jenkins job(s): %s" % ", ".join(jobs))
|
||||
for job in jobs:
|
||||
|
@ -53,4 +53,4 @@ class DeleteSubCommand(base.BaseSubCommand):
|
||||
else:
|
||||
jobs = [jobs_glob]
|
||||
|
||||
builder.delete_job(jobs)
|
||||
builder.delete_jobs(jobs)
|
||||
|
@ -27,7 +27,7 @@ from tests.cmd.test_cmd import CmdTestsBase
|
||||
@mock.patch('jenkins_jobs.builder.Jenkins.get_plugins_info', mock.MagicMock)
|
||||
class DeleteTests(CmdTestsBase):
|
||||
|
||||
@mock.patch('jenkins_jobs.cli.subcommand.delete.Builder.delete_job')
|
||||
@mock.patch('jenkins_jobs.cli.subcommand.delete.Builder.delete_jobs')
|
||||
def test_delete_single_job(self, delete_job_mock):
|
||||
"""
|
||||
Test handling the deletion of a single Jenkins job.
|
||||
@ -36,7 +36,7 @@ class DeleteTests(CmdTestsBase):
|
||||
args = ['--conf', self.default_config_file, 'delete', 'test_job']
|
||||
self.execute_jenkins_jobs_with_args(args)
|
||||
|
||||
@mock.patch('jenkins_jobs.cli.subcommand.delete.Builder.delete_job')
|
||||
@mock.patch('jenkins_jobs.cli.subcommand.delete.Builder.delete_jobs')
|
||||
def test_delete_multiple_jobs(self, delete_job_mock):
|
||||
"""
|
||||
Test handling the deletion of multiple Jenkins jobs.
|
||||
|
Loading…
Reference in New Issue
Block a user