update func sig

This commit is contained in:
felinae98
2022-03-20 19:36:24 +08:00
parent 3d9523f5f3
commit 0aaaa86c24
3 changed files with 24 additions and 22 deletions
+9 -10
View File
@@ -1,13 +1,11 @@
import asyncio
import pytest
from nonebug import App
@pytest.mark.asyncio
async def test_send_no_queue(app: App):
import nonebot
from nonebot.adapters.onebot.v11.bot import Bot
from nonebot.adapters.onebot.v11.message import Message
from nonebot_bison.plugin_config import plugin_config
from nonebot_bison.send import send_msgs
@@ -16,16 +14,16 @@ async def test_send_no_queue(app: App):
bot = ctx.create_bot(base=Bot)
assert isinstance(bot, Bot)
ctx.should_call_api(
"send_group_msg", {"group_id": "1233", "message": "msg1"}, True
"send_group_msg", {"group_id": "1233", "message": Message("msg1")}, True
)
ctx.should_call_api(
"send_group_msg", {"group_id": "1233", "message": "msg2"}, True
"send_group_msg", {"group_id": "1233", "message": Message("msg2")}, True
)
ctx.should_call_api(
"send_private_msg", {"user_id": "666", "message": "priv"}, True
"send_private_msg", {"user_id": "666", "message": Message("priv")}, True
)
await send_msgs(bot, "1233", "group", ["msg1", "msg2"])
await send_msgs(bot, "666", "private", ["priv"])
await send_msgs(bot, "1233", "group", [Message("msg1"), Message("msg2")])
await send_msgs(bot, "666", "private", [Message("priv")])
assert ctx.wait_list.empty()
@@ -33,9 +31,10 @@ async def test_send_no_queue(app: App):
async def test_send_queue(app: App):
import nonebot
from nonebot.adapters.onebot.v11.bot import Bot
from nonebot.adapters.onebot.v11.message import Message
from nonebot_bison import send
from nonebot_bison.plugin_config import plugin_config
from nonebot_bison.send import LAST_SEND_TIME, do_send_msgs, send_msgs
from nonebot_bison.send import do_send_msgs, send_msgs
async with app.test_api() as ctx:
new_bot = ctx.create_bot(base=Bot)
@@ -48,7 +47,7 @@ async def test_send_queue(app: App):
"send_group_msg", {"group_id": "1233", "message": "test msg"}, True
)
await bot.call_api("send_group_msg", group_id="1233", message="test msg")
await send_msgs(bot, "1233", "group", ["msg"])
await send_msgs(bot, "1233", "group", [Message("msg")])
ctx.should_call_api(
"send_group_msg", {"group_id": "1233", "message": "msg"}, True
)