Exemple #1
0
def test_runner_start_and_stop():
    runner = LoaferRunner(loop=mock.Mock())
    runner.stop = mock.Mock()
    runner.start(run_forever=False)
    assert runner.loop.run_forever.called
    assert runner.stop.called
    assert runner.loop.close.called
Exemple #2
0
def test_runner_start_and_stop():
    runner = LoaferRunner(loop=mock.Mock())
    runner.stop = mock.Mock()
    runner.start(run_forever=False)
    assert runner.loop.run_forever.called
    assert runner.stop.called
    assert runner.loop.close.called
Exemple #3
0
def test_runner_start_and_stop(loop_mock):
    runner = LoaferRunner()
    runner.stop = mock.Mock()

    runner.start()

    assert runner.stop.called
    assert loop_mock.return_value.run_forever.called
    assert loop_mock.return_value.close.called
Exemple #4
0
def test_runner_start(loop_mock):
    runner = LoaferRunner()

    runner.start()

    assert loop_mock.return_value.run_forever.called
Exemple #5
0
def test_runner_start_with_debug(loop_mock):
    runner = LoaferRunner()

    runner.start(debug=True)

    loop_mock.return_value.set_debug.assert_called_once_with(enabled=True)
Exemple #6
0
def test_runner_start():
    runner = LoaferRunner(loop=mock.Mock())
    runner.start()
    assert runner.loop.run_forever.called
Exemple #7
0
def test_runner_with_cancelled_error():
    runner = LoaferRunner(loop=mock.Mock())
    runner.loop.run_forever.side_effect = CancelledError
    runner.start()
    assert runner.loop.run_forever.called
    assert runner.loop.close.called
Exemple #8
0
def test_runner_start_run_until_complete():
    runner = LoaferRunner(loop=mock.Mock())
    runner.stop = mock.Mock()
    runner.start(run_forever=False)
    assert runner.loop.run_until_complete.called
    assert runner.stop.called
Exemple #9
0
def test_runner_start_with_debug():
    loop = mock.Mock()
    runner = LoaferRunner(loop=loop)
    runner.start(debug=True)
    loop.set_debug.assert_called_once_with(enabled=True)
Exemple #10
0
def test_runner_start_with_debug():
    loop = mock.Mock()
    runner = LoaferRunner(loop=loop)
    runner.start(debug=True)
    assert loop.set_debug.called_once_with(enabled=True)