def test_kill_process(self, mock_task_kill, mock_exit): mock_task_kill_inst = mock.Mock() mock_task_kill.return_value = mock_task_kill_inst mock_task_kill_inst.wait.side_effect = task.TaskError("error data") ctx = mock.Mock(sbd=True) main.kill_process(ctx) mock_task_kill_inst.pre_check.assert_called_once_with() mock_task_kill_inst.print_header.assert_called_once_with() mock_task_kill_inst.enable_report.assert_called_once_with() mock_task_kill_inst.run.assert_called_once_with() mock_task_kill_inst.wait.assert_called_once_with() mock_task_kill_inst.error.assert_called_once_with("error data") mock_exit.assert_called_once_with(1)
def test_kill_porcess_return(self, mock_task_kill): ctx = mock.Mock(pacemakerd=False, sbd=False, corosync=False) main.kill_process(ctx) mock_task_kill.assert_not_called()
def test_kill_porcess_return_pacemaker_loop(self, mock_task_kill): ctx = mock.Mock(pacemakerd=True, loop=True, sbd=None, corosync=None) main.kill_process(ctx) mock_task_kill.assert_not_called()