mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-03-05 05:36:54 +08:00
✅ 添加单元测试 (#513)
* ➕ 添加测试依赖 nonebug * ➕ 添加测试依赖 pytest-asyncio * 🔧 配置 pytest * 🙈 更新 .gitignore * ➕ 添加 test 依赖 pytest-cov * 🔧 配置 pytest * ✅ 添加测试 * 👷 添加 Test CI * 💚 暂时移除 3.13 的测试
This commit is contained in:
19
tests/tetrio/test_bind.py
Normal file
19
tests/tetrio/test_bind.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import pytest
|
||||
from nonebot.adapters.onebot.v11 import Message
|
||||
from nonebug import App # type: ignore[import-untyped]
|
||||
|
||||
from tests.fake_event import FakeGroupMessageEvent
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_name(app: App) -> None:
|
||||
from nonebot_plugin_tetris_stats.games import alc
|
||||
|
||||
raw_message = 'tstats tetrio bind 芜湖'
|
||||
message = Message(raw_message)
|
||||
event = FakeGroupMessageEvent(message=message, original_message=message, raw_message=raw_message)
|
||||
async with app.test_matcher(alc) as ctx:
|
||||
bot = ctx.create_bot()
|
||||
ctx.receive_event(bot, event)
|
||||
ctx.should_finished(alc)
|
||||
ctx.should_call_send(event, '用户名/ID不合法', result=None)
|
||||
Reference in New Issue
Block a user