mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-09 18:27:56 +08:00
update func sig
This commit is contained in:
+9
-10
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user