def test_get_current_executable(self, _poll_executor): _poll_executor.return_value = self.EXEC0 baseurl = 'http://localhost:8080/computer/host0.host.com/executors/0' nodename = 'host0.host.com' single_executer = Executor(baseurl, nodename, self.J, '0') self.assertEquals(single_executer.get_current_executable()['number'], 4168) self.assertEquals(single_executer.get_current_executable()['url'], 'http://localhost:8080/job/testjob/4168/')
def test_likely_stuck(jenkins, monkeypatch): def fake_poll_extr(cls, tree=None): # pylint: disable=unused-argument return EXEC0 monkeypatch.setattr(Executor, '_poll', fake_poll_extr) baseurl = 'http://localhost:8080/computer/host0.host.com/executors/0' nodename = 'host0.host.com' single_executer = Executor(baseurl, nodename, jenkins, '0') assert single_executer.likely_stuck() is False
def test_get_current_executable(jenkins, monkeypatch): def fake_poll_extr(cls, tree=None): # pylint: disable=unused-argument return EXEC0 monkeypatch.setattr(Executor, '_poll', fake_poll_extr) baseurl = 'http://localhost:8080/computer/host0.host.com/executors/0' nodename = 'host0.host.com' single_executer = Executor(baseurl, nodename, jenkins, '0') assert single_executer.get_current_executable()['number'] == 4168 assert single_executer.get_current_executable()['url'] == \ 'http://localhost:8080/job/testjob/4168/'
def test_get_current_executable(self, _poll_executor): _poll_executor.return_value = self.EXEC0 baseurl = 'http://localhost:8080/computer/host0.host.com/executors/0' nodename = 'host0.host.com' single_executer = Executor(baseurl, nodename, self.J, '0') self.assertEquals( single_executer.get_current_executable()['number'], 4168 ) self.assertEquals( single_executer.get_current_executable()['url'], 'http://localhost:8080/job/testjob/4168/' )
def __iter__(self): for index in range(self.count): executor_url = '%s/executors/%s' % (self.baseurl, index) yield Executor( executor_url, self.nodename, self.jenkins, index )
def test_likely_stuck(self, _poll_executor): _poll_executor.return_value = self.EXEC0 baseurl = 'http://localhost:8080/computer/host0.host.com/executors/0' nodename = 'host0.host.com' single_executer = Executor(baseurl, nodename, self.J, '0') self.assertEquals(single_executer.likely_stuck(), False)