Пример #1
0
    async def test_async_call(self):
        async def func(obj):
            obj()

        ui = mock.Mock()
        hooks = mock.Mock()
        hooks.ui = None
        hooks.func = func

        with mock.patch('alot.commands.globals.settings.hooks', hooks):
            cmd = g_commands.CallCommand('hooks.func(ui)')
            await cmd.apply(ui)
            ui.assert_called_once()
Пример #2
0
 async def test_synchronous_call(self):
     ui = mock.Mock()
     cmd = g_commands.CallCommand('ui()')
     await cmd.apply(ui)
     ui.assert_called_once()