mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-05 19:36:43 +08:00
update send test
This commit is contained in:
parent
1e9990b783
commit
a0b98f5c9c
@ -32,6 +32,7 @@ async def test_send_no_queue(app: App):
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_send_queue(app: App):
|
async def test_send_queue(app: App):
|
||||||
import nonebot
|
import nonebot
|
||||||
|
from nonebot_bison import send
|
||||||
from nonebot_bison.plugin_config import plugin_config
|
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 LAST_SEND_TIME, do_send_msgs, send_msgs
|
||||||
|
|
||||||
@ -50,7 +51,8 @@ async def test_send_queue(app: App):
|
|||||||
ctx.should_call_api(
|
ctx.should_call_api(
|
||||||
"send_group_msg", {"group_id": "1233", "message": "msg"}, True
|
"send_group_msg", {"group_id": "1233", "message": "msg"}, True
|
||||||
)
|
)
|
||||||
LAST_SEND_TIME = 0
|
await do_send_msgs()
|
||||||
await asyncio.sleep(2)
|
assert not ctx.wait_list.empty()
|
||||||
|
app.monkeypatch.setattr(send, "LAST_SEND_TIME", 0, True)
|
||||||
await do_send_msgs()
|
await do_send_msgs()
|
||||||
assert ctx.wait_list.empty()
|
assert ctx.wait_list.empty()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user