git reimport

This commit is contained in:
2019-03-15 15:02:19 +04:00
commit 742797309a
90 changed files with 4411 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import pytest
from zvk.event.consumer import on_startup
@on_startup
async def inc(api, bot):
bot.counter += await api.get_magic.inc(type='test')
bot.counter += await api.get_magic.inc(type='test')
bot.counter += await api.get_magic.inc(type='test')
with pytest.raises(ValueError):
await api.get_magic.inc(type='test')
@pytest.mark.asyncio
async def test_api(bot):
bot.api.expect('get_magic.inc', type='test').set_result(1)
bot.api.expect('get_magic.inc', type='test').set_result(2)
bot.api.expect('get_magic.inc', type='*').set_result(3)
bot.counter = 0
bot.event_queue.register_consumer(inc)
assert await bot.run()
assert bot.counter == 6