Merge "Fixes delete-all command when no option is provided"

This commit is contained in:
Zuul 2018-06-01 00:23:58 +00:00 committed by Gerrit Code Review
commit 1614f4f992
2 changed files with 6 additions and 4 deletions

View File

@ -69,10 +69,10 @@ class DeleteAllSubCommand(base.BaseSubCommand):
'Job Builder)'.format(" AND ".join(reach))):
sys.exit('Aborted')
if options.del_jobs:
if 'jobs' in reach:
logger.info("Deleting all jobs")
builder.delete_all_jobs()
if options.del_views:
if 'views' in reach:
logger.info("Deleting all views")
builder.delete_all_views()

View File

@ -33,8 +33,10 @@ class DeleteAllTests(CmdTestsBase):
"""
args = ['--conf', self.default_config_file, 'delete-all']
with mock.patch('jenkins_jobs.utils.input', return_value="y"):
self.execute_jenkins_jobs_with_args(args)
with mock.patch('jenkins_jobs.builder.JenkinsManager.get_views',
return_value=[None]):
with mock.patch('jenkins_jobs.utils.input', return_value="y"):
self.execute_jenkins_jobs_with_args(args)
@mock.patch('jenkins_jobs.cli.subcommand.update.'
'JenkinsManager.delete_all_jobs')