diff options
author | Kyomotoi <[email protected]> | 2022-02-03 14:36:24 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2022-02-03 14:36:24 +0800 |
commit | 3e32ca3964ff8f40e0b491e87f153040f2348fd0 (patch) | |
tree | d04d19ba5a25f6f1f6a9c4f8c398d49eb252df3c /test/test_plugin_saucenao.py | |
parent | f5a020d45f7294214bbcd488955b9c391d651a6d (diff) | |
download | ATRI-3e32ca3964ff8f40e0b491e87f153040f2348fd0.tar.gz ATRI-3e32ca3964ff8f40e0b491e87f153040f2348fd0.tar.bz2 ATRI-3e32ca3964ff8f40e0b491e87f153040f2348fd0.zip |
🔖 更新版本:
更新记录请参考文档: atri.kyomotoi.moe/changelog/overview/
Diffstat (limited to 'test/test_plugin_saucenao.py')
-rw-r--r-- | test/test_plugin_saucenao.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/test_plugin_saucenao.py b/test/test_plugin_saucenao.py new file mode 100644 index 0000000..2782ba9 --- /dev/null +++ b/test/test_plugin_saucenao.py @@ -0,0 +1,32 @@ +import pytest +from nonebug import App + +from nonebot.adapters.onebot.v11 import MessageSegment + +from .utils import make_fake_message, make_fake_event + + +async def test_saucenao(app: App): + from ATRI.plugins.saucenao import saucenao + + Message = make_fake_message() + + async with app.test_matcher(saucenao) as ctx: + bot = ctx.create_bot() + + msg = Message("以图搜图") + event = make_fake_event(_message=msg)() + + ctx.receive_event(bot, event) + ctx.should_call_send(event, "图呢?", True) + + msg = Message( + MessageSegment.image( + "https://cdn.jsdelivr.net/gh/Kyomotoi/CDN@master/noting/88674944_p0.png" + ) + ) + event = make_fake_event(_message=msg)() + + ctx.receive_event(bot, event) + ctx.should_call_send(event, "失败了...", False) |