Add new file
This commit is contained in:
22
tests/integration/test_commands.py
Normal file
22
tests/integration/test_commands.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""
|
||||
Интеграционные тесты для команд бота (проверяют вызовы RAGClient).
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
|
||||
# Импортируем команды
|
||||
from core.commands.clear import ClearCommand
|
||||
from core.commands.kb import KbCommand
|
||||
# ... и другие
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_clear_command():
|
||||
bot = MagicMock()
|
||||
bot.rag_client = AsyncMock()
|
||||
bot.rag_client.clear = AsyncMock(return_value={"status": "ok"})
|
||||
cmd = ClearCommand(bot)
|
||||
msg = MagicMock()
|
||||
msg.reply.return_value = MagicMock()
|
||||
await cmd.execute(msg, "", "user@domain", None)
|
||||
bot.rag_client.clear.assert_called_once_with("user@domain", None, False)
|
||||
Reference in New Issue
Block a user