ListSubCommand: return job fullname
Change-Id: Id1e53d05383efad191ad254ff0f17e3c573aeb65
This commit is contained in:
parent
d044db609a
commit
f6556f5636
@ -58,9 +58,9 @@ class ListSubCommand(base.BaseSubCommand):
|
||||
jobs = [j["name"] for j in p.jobs]
|
||||
else:
|
||||
jobs = [
|
||||
j["name"]
|
||||
j["fullname"]
|
||||
for j in self.jenkins.get_jobs()
|
||||
if not jobs_glob or parser.matches(j["name"], jobs_glob)
|
||||
if not jobs_glob or parser.matches(j["fullname"], jobs_glob)
|
||||
]
|
||||
|
||||
jobs = sorted(jobs)
|
||||
|
@ -27,6 +27,14 @@ class ListFromJenkinsTests(TestWithScenarios, CmdTestsBase):
|
||||
scenarios = [
|
||||
("single", dict(jobs=["job1"], globs=[], found=["job1"])),
|
||||
("multiple", dict(jobs=["job1", "job2"], globs=[], found=["job1", "job2"])),
|
||||
(
|
||||
"multiple_with_folder",
|
||||
dict(
|
||||
jobs=["folder1", "folder1/job1", "folder1/job2"],
|
||||
globs=[],
|
||||
found=["folder1", "folder1/job1", "folder1/job2"]
|
||||
)
|
||||
),
|
||||
(
|
||||
"multiple_with_glob",
|
||||
dict(
|
||||
@ -48,7 +56,7 @@ class ListFromJenkinsTests(TestWithScenarios, CmdTestsBase):
|
||||
@mock.patch("jenkins_jobs.builder.JenkinsManager.get_jobs")
|
||||
def test_list(self, get_jobs_mock):
|
||||
def _get_jobs():
|
||||
return [{"name": name} for name in self.jobs]
|
||||
return [{"fullname": fullname} for fullname in self.jobs]
|
||||
|
||||
get_jobs_mock.side_effect = _get_jobs
|
||||
console_out = io.BytesIO()
|
||||
|
Loading…
x
Reference in New Issue
Block a user