def test_runner_prepare_stop(loop_mock): loop_mock.return_value.is_running.return_value = True runner = LoaferRunner() runner.prepare_stop() loop_mock.return_value.stop.assert_called_once_with()
def test_runner_prepare_stop_already_stopped(get_loop_mock): loop = mock.Mock(is_running=mock.Mock(return_value=False)) get_loop_mock.return_value = loop runner = LoaferRunner() runner.prepare_stop() loop.is_running.assert_called_once_with() assert loop.stop.called is False
def test_runner_prepare_stop(): runner = LoaferRunner(loop=mock.Mock()) runner.prepare_stop() runner.loop.stop.assert_called_once_with()
def test_runner_prepare_stop_already_stopped(): loop = mock.Mock(is_running=mock.Mock(return_value=False)) runner = LoaferRunner(loop=loop) runner.prepare_stop() loop.is_running.assert_called_once_with() assert loop.stop.called is False