def test_delete_job(self, mock_jenkins, _): jxcore = JxCore() jxcore.delete_job("test_job") mock_jenkins.assert_called_with("test_job")
def test_abort_job_exception(self, mock_jenkins, _): mock_jenkins.side_effect = jenkins.JenkinsException() with self.assertRaises(jenkins.JenkinsException) as exception: jxcore = JxCore() jxcore.abort_job("test_job", 10) self.assertEqual(str(exception.exception), "Job/Build not found")
def test_trigger_job(self, mock_jenkins, _): param = {"node": "test"} jxcore = JxCore() jxcore.trigger_job("test_job", param) mock_jenkins.assert_called_with("test_job", param)
def test_abort_job(self, mock_jenkins, _): jxcore = JxCore() jxcore.abort_job("test_job", 10) mock_jenkins.assert_called_with("test_job", 10)
def test_jxcore_init_exception(self, mock_jenkins, mock_ctxcore, mock_exit): mock_jenkins.side_effect = jenkins.JenkinsException() mock_ctxcore.validate_context.return_value = True jxcore = JxCore() mock_exit.assert_called_once()