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()
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)