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

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

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

    assert module._actions[name] == action  # noqa

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