Exemple #1
0
def noninteractive(mocker: MockerFixture) -> MagicMock:
    loop = asyncio.get_event_loop()
    # The Click.testing.CliRunner replaces `sys.stdin` with something that is
    # notcompatible with `add_reader` so we just mock the call.
    mocker.patch.object(loop, 'add_reader', lambda *_: None)
    mocker.patch.object(loop, 'remove_reader', lambda *_: None)
    mock: MagicMock = mocker.MagicMock(name='Foremon._run')
    mocker.patch('foremon.app.Foremon._run', new=mock)
    spy = mocker.spy(Foremon, 'run_forever')
    return spy
    def test_function_calls_request_headers_get(self, mocker: MockerFixture):
        req = mocker.MagicMock()
        ffa.get_authorization_header(req)

        req.headers.get.assert_called_once_with("Authorization")
Exemple #3
0
async def fake_task_handlers(mocker: MockerFixture) -> TaskHandlers:
    return TaskHandlers(mocker.MagicMock(), mocker.MagicMock(), mocker.MagicMock())
Exemple #4
0
def mocked_user_completed_cb(mocker: MockerFixture) -> mock.MagicMock:
    return mocker.MagicMock()