diff --git a/tests/jobs/base.py b/tests/jobs/base.py index 5913271..68e5a87 100644 --- a/tests/jobs/base.py +++ b/tests/jobs/base.py @@ -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': [ diff --git a/tests/jobs/test_get.py b/tests/jobs/test_get.py index 43de9f8..aec7c03 100644 --- a/tests/jobs/test_get.py +++ b/tests/jobs/test_get.py @@ -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] diff --git a/tests/jobs/test_getall.py b/tests/jobs/test_getall.py index ffef71a..a7bfd54 100644 --- a/tests/jobs/test_getall.py +++ b/tests/jobs/test_getall.py @@ -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(