git reimport
This commit is contained in:
27
tests/zvk/plugins/vk/test_testing_api.py
Normal file
27
tests/zvk/plugins/vk/test_testing_api.py
Normal 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
|
Reference in New Issue
Block a user