def test_trigger_job_exception(self, mock_jenkins, _): mock_jenkins.side_effect = jenkins.JenkinsException() param = {"node": "test"} with self.assertRaises(jenkins.JenkinsException) as exception: jxcore = JxCore() jxcore.trigger_job("test_job", param) self.assertEqual(str(exception.exception), "Job 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)