summaryrefslogtreecommitdiff
path: root/test/test_plugin_funny.py
blob: ff95f57cb1fa8a92df3428cd200c8d0b1758ccaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import pytest
from nonebug import App

from nonebot.adapters.onebot.v11 import Bot, Message

from .utils import group_message_event


@pytest.mark.asyncio
async def test_fake_msg(app: App):
    from ATRI.plugins.funny import fake_msg

    async with app.test_matcher(fake_msg) as ctx:
        bot = ctx.create_bot(base=Bot)

        event = group_message_event(message=Message("/fakemsg"))

        ctx.receive_event(bot, event)
        ctx.should_call_send(event, "内容呢?格式:qq-name-content\n可构造多条,以上仅为一条,使用空格隔开", True)

        event = group_message_event(message=Message("114514-0w0-testing"))

        ctx.receive_event(bot, event)
        ctx.should_call_api(
            "send_group_forward_msg",
            {
                "group_id": 10000,
                "messages": [
                    {
                        "type": "node",
                        "data": {"name": "0w0", "uin": "114514", "content": "testing"},
                    }
                ],
            },
            True,
        )