Beispiel #1
0
async def test_execute_view_async(module: Module) -> None:
    name = 'view'
    mock = AsyncMock(name='view')
    module.view(name, function=mock)

    await module.execute_action(f'view_submission:{name}')
    mock.assert_awaited_once()
Beispiel #2
0
def test_add_view(module: Module) -> None:
    name = 'test'

    @module.view(name)
    async def view() -> None:
        pass

    assert module._views[name] == view  # noqa

    with pytest.raises(AssertionError):
        module.view(name, function=view)