Merge "Merge jobs_in_folder_named_job into jobs_in_folder"
This commit is contained in:
commit
7166f872f5
@ -16,12 +16,17 @@ class JenkinsGetJobsTestBase(JenkinsJobsTestBase):
|
||||
{'jobs': [
|
||||
{'name': 'my_job1', 'color': 'blue', 'url': 'http://...'},
|
||||
{'name': 'my_folder1', 'url': 'http://...', 'jobs': [{}, {}]},
|
||||
{'name': 'my_job2', 'color': 'blue', 'url': 'http://...'}
|
||||
{'name': 'my_job2', 'color': 'blue', 'url': 'http://...'},
|
||||
{'name': 'job', 'url': 'http://...', 'jobs': [{}]}
|
||||
]},
|
||||
# my_folder1 jobs
|
||||
{'jobs': [
|
||||
{'name': 'my_job3', 'color': 'blue', 'url': 'http://...'},
|
||||
{'name': 'my_job4', 'color': 'blue', 'url': 'http://...'}
|
||||
]},
|
||||
# "job" folder jobs
|
||||
{'jobs': [
|
||||
{'name': 'my_job', 'color': 'blue', 'url': 'http://...'}
|
||||
]}
|
||||
]
|
||||
|
||||
@ -62,17 +67,6 @@ class JenkinsGetJobsTestBase(JenkinsJobsTestBase):
|
||||
]}
|
||||
]
|
||||
|
||||
jobs_in_folder_named_job = [
|
||||
# actually a folder :-)
|
||||
{'jobs': [
|
||||
{'name': 'job', 'url': 'http://...', 'jobs': [{}]}
|
||||
]},
|
||||
# "job" folder jobs
|
||||
{'jobs': [
|
||||
{'name': 'my_job', 'color': 'blue', 'url': 'http://...'}
|
||||
]}
|
||||
]
|
||||
|
||||
jobs_in_folder_deep_query = [
|
||||
{'jobs': [
|
||||
{'name': 'top_folder', 'url': 'http://...', 'jobs': [
|
||||
|
@ -34,7 +34,7 @@ class JenkinsGetJobsTest(JenkinsGetJobsTestBase):
|
||||
jobs_info = self.j.get_jobs()
|
||||
|
||||
expected_fullnames = [
|
||||
u"my_job1", u"my_folder1", u"my_job2"
|
||||
u"my_job1", u"my_folder1", u"my_job2", u"job"
|
||||
]
|
||||
self.assertEqual(len(expected_fullnames), len(jobs_info))
|
||||
got_fullnames = [job[u"fullname"] for job in jobs_info]
|
||||
@ -47,8 +47,8 @@ class JenkinsGetJobsTest(JenkinsGetJobsTestBase):
|
||||
jobs_info = self.j.get_jobs(folder_depth=1)
|
||||
|
||||
expected_fullnames = [
|
||||
u"my_job1", u"my_folder1", u"my_job2",
|
||||
u"my_folder1/my_job3", u"my_folder1/my_job4"
|
||||
u"my_job1", u"my_folder1", u"my_job2", u"job",
|
||||
u"my_folder1/my_job3", u"my_folder1/my_job4", u"job/my_job"
|
||||
]
|
||||
self.assertEqual(len(expected_fullnames), len(jobs_info))
|
||||
got_fullnames = [job[u"fullname"] for job in jobs_info]
|
||||
|
@ -14,8 +14,8 @@ class JenkinsGetAllJobsTest(JenkinsGetJobsTestBase):
|
||||
jobs_info = self.j.get_all_jobs()
|
||||
|
||||
expected_fullnames = [
|
||||
u"my_job1", u"my_folder1", u"my_job2",
|
||||
u"my_folder1/my_job3", u"my_folder1/my_job4"
|
||||
u"my_job1", u"my_folder1", u"my_job2", u"job",
|
||||
u"my_folder1/my_job3", u"my_folder1/my_job4", u"job/my_job"
|
||||
]
|
||||
self.assertEqual(len(expected_fullnames), len(jobs_info))
|
||||
got_fullnames = [job[u"fullname"] for job in jobs_info]
|
||||
@ -23,7 +23,8 @@ class JenkinsGetAllJobsTest(JenkinsGetJobsTestBase):
|
||||
|
||||
expected_request_urls = [
|
||||
self.make_url('api/json'),
|
||||
self.make_url('job/my_folder1/api/json')
|
||||
self.make_url('job/my_folder1/api/json'),
|
||||
self.make_url('job/job/api/json')
|
||||
]
|
||||
self.assertEqual(expected_request_urls,
|
||||
self.got_request_urls(jenkins_mock))
|
||||
@ -102,25 +103,6 @@ class JenkinsGetAllJobsTest(JenkinsGetJobsTestBase):
|
||||
self.assertEqual(expected_request_urls,
|
||||
self.got_request_urls(jenkins_mock))
|
||||
|
||||
@patch.object(jenkins.Jenkins, 'jenkins_open')
|
||||
def test_folder_named_job(self, jenkins_mock):
|
||||
jenkins_mock.side_effect = map(
|
||||
json.dumps, self.jobs_in_folder_named_job)
|
||||
|
||||
jobs_info = self.j.get_all_jobs()
|
||||
|
||||
expected_fullnames = [u"job", u"job/my_job"]
|
||||
self.assertEqual(len(expected_fullnames), len(jobs_info))
|
||||
got_fullnames = [job[u"fullname"] for job in jobs_info]
|
||||
self.assertEqual(expected_fullnames, got_fullnames)
|
||||
|
||||
expected_request_urls = [
|
||||
self.make_url('api/json'),
|
||||
self.make_url('job/job/api/json'),
|
||||
]
|
||||
self.assertEqual(expected_request_urls,
|
||||
self.got_request_urls(jenkins_mock))
|
||||
|
||||
@patch.object(jenkins.Jenkins, 'jenkins_open')
|
||||
def test_deep_query(self, jenkins_mock):
|
||||
jenkins_mock.side_effect = map(
|
||||
|
Loading…
Reference in New Issue
Block a user