def get_executors(self, nodename):
url = '%s/computer/%s' % (self.baseurl, nodename)
return Executors(url, nodename, self)
-
+
def get_version(self):
"""
Return version number of Jenkins
"""
- r = self.requester.get_and_confirm_status(self.baseurl)
+ response = self.requester.get_and_confirm_status(self.baseurl)
try:
- return r.headers['X-jenkins']
+ return response.headers['X-jenkins']
except KeyError:
- msg = '%s is not a valid Jenkins URL.' %(self.baseurl)
+ msg = '%s is not a valid Jenkins URL.' % (self.baseurl)
raise BadURL(msg)
@mock.patch.object(JenkinsBase, '_poll')
@mock.patch.object(Jenkins, '_poll')
- def test_get_version(self, _base_poll,_poll):
+ def test_get_version(self, _base_poll, _poll):
class MockResponse(object):
def __init__(self):
self.headers = {}
@mock.patch.object(JenkinsBase, '_poll')
@mock.patch.object(Jenkins, '_poll')
- def test_get_version_exception(self, _base_poll,_poll):
+ def test_get_version_exception(self, _base_poll, _poll):
class MockResponse(object):
def __init__(self):
self.headers = {}
requester=mock_requester)
with self.assertRaises(BadURL) as context:
J.get_version()
- msg = '%s is not a valid Jenkins URL.' %(base_url)
- self.assertEqual(context.exception.message,msg)
+ msg = '%s is not a valid Jenkins URL.' % (base_url)
+ self.assertEqual(context.exception.message, msg)
class TestJenkinsURLs(unittest.TestCase):