diff options
Diffstat (limited to 'simplejenkinsapi/api_tests.py')
-rw-r--r-- | simplejenkinsapi/api_tests.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/simplejenkinsapi/api_tests.py b/simplejenkinsapi/api_tests.py index 6e7c943..6c04c53 100644 --- a/simplejenkinsapi/api_tests.py +++ b/simplejenkinsapi/api_tests.py @@ -1,17 +1,17 @@ # simplejenkinsapi/api_tests.py -- unit test for simplejenkinsapi/api.py # # Copyright 2012 Lars Wirzenius -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. @@ -31,13 +31,13 @@ class DummyResponse(object): self.reason = 'yeah yeah' self.body = body self.content_type = content_type - + def getheader(self, header): if header == 'Content-Type': return self.content_type else: return '' - + def read(self): return self.body @@ -53,7 +53,7 @@ class DummyServer(object): self.add_route('POST', '/job/job-1/config.xml', self.update_job_1) self.jobs = {} - + self.response = None def add_route(self, method, path, callback): @@ -95,7 +95,7 @@ class DummyServer(object): key = (method, path) assert key in self.routes self.response, self.response_type = self.routes[key](body, headers) - + def getresponse(self): return DummyResponse(self.response, self.response_type) @@ -105,26 +105,26 @@ class JenkinsTests(unittest.TestCase): def setUp(self): self.url = 'http://does.not.exist:8080/' self.jenkins = simplejenkinsapi.Jenkins(self.url) - + self.dummy_server = DummyServer() self.jenkins._connect = lambda: self.dummy_server - + self.config_xml = ''' <?xml version="1.0" encoding="UTF-8"?> <project> </project> ''' - + self.config_xml_2 = ''' <?xml version="1.0" encoding="UTF-8"?> <project> <foo/> </project> ''' - + def test_lists_no_jobs_when_there_are_none(self): self.assertEqual(self.jenkins.list_jobs(), []) - + def test_lists_single_job_when_one_exists(self): self.dummy_server.jobs = { 'job-1': '' } self.assertEqual(self.jenkins.list_jobs(), ['job-1']) @@ -142,6 +142,6 @@ class JenkinsTests(unittest.TestCase): def test_updates_job(self): self.jenkins.create_job('job-1', self.config_xml) self.jenkins.update_job('job-1', self.config_xml_2) - self.assertEqual(self.jenkins.get_job_config('job-1'), + self.assertEqual(self.jenkins.get_job_config('job-1'), self.config_xml_2) |