class TestLabel(unittest.TestCase): DATA = {"actions":[], "busyExecutors":0, "clouds":[], "description":None, "idleExecutors":0, "loadStatistics":{}, "name":"jenkins-slave", "nodes":[], "offline":True, "tiedJobs":[ {"name":"test_job1", "url":"http://*****:*****@mock.patch.object(Label, '_poll') def setUp(self, _poll): _poll.return_value = self.DATA # def __init__(self, baseurl, labelname, jenkins_obj): self.J = mock.MagicMock() # Jenkins object self.n = Label('http://*****:*****@mock.patch.object(Label, '_poll') def test_get_tied_job_names(self, _poll): _poll.return_value = self.DATA return self.assertEquals(self.n.get_tied_job_names(), self.DATA_JOBS) @mock.patch.object(Label, '_poll') def test_online(self, _poll): _poll.return_value = self.DATA return self.assertEquals(self.n.is_online(), False)
class TestLabel(unittest.TestCase): DATA = { "actions": [], "busyExecutors": 0, "clouds": [], "description": None, "idleExecutors": 0, "loadStatistics": {}, "name": "jenkins-slave", "nodes": [], "offline": True, "tiedJobs": [{ "name": "test_job1", "url": "http://*****:*****@mock.patch.object(Label, '_poll') def setUp(self, _poll): _poll.return_value = self.DATA # def __init__(self, baseurl, labelname, jenkins_obj): self.J = mock.MagicMock() # Jenkins object self.n = Label('http://*****:*****@mock.patch.object(Label, '_poll') def test_get_tied_job_names(self, _poll): _poll.return_value = self.DATA return self.assertEquals(self.n.get_tied_job_names(), self.DATA_JOBS) @mock.patch.object(Label, '_poll') def test_online(self, _poll): _poll.return_value = self.DATA return self.assertEquals(self.n.is_online(), False)