update send test

This commit is contained in:
felinae98 2022-02-13 22:02:12 +08:00
parent 1e9990b783
commit a0b98f5c9c
No known key found for this signature in database
GPG Key ID: 00C8B010587FF610

View File

@ -32,6 +32,7 @@ async def test_send_no_queue(app: App):
@pytest.mark.asyncio
async def test_send_queue(app: App):
import nonebot
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
@ -50,7 +51,8 @@ async def test_send_queue(app: App):
ctx.should_call_api(
"send_group_msg", {"group_id": "1233", "message": "msg"}, True
)
LAST_SEND_TIME = 0
await asyncio.sleep(2)
await do_send_msgs()
assert not ctx.wait_list.empty()
app.monkeypatch.setattr(send, "LAST_SEND_TIME", 0, True)
await do_send_msgs()
assert ctx.wait_list.empty()