chore: remove legacy test_mock_platform.py
This commit is contained in:
parent
c87b37ad64
commit
6f0e9a53a6
1 changed files with 0 additions and 71 deletions
|
|
@ -1,71 +0,0 @@
|
|||
"""Тесты для MockPlatformClient — проверяем что заглушка работает корректно."""
|
||||
|
||||
import pytest
|
||||
from src.mock_platform import MockPlatformClient, SessionNotFoundError
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client():
|
||||
return MockPlatformClient()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_create_session_returns_ids(client):
|
||||
result = await client.create_session(user_id="tg-123", platform="telegram")
|
||||
|
||||
assert "session_id" in result
|
||||
assert "agent_id" in result
|
||||
assert "expires_at" in result
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_send_message_returns_response(client):
|
||||
session = await client.create_session(user_id="tg-123", platform="telegram")
|
||||
result = await client.send_message(session["session_id"], "Привет!")
|
||||
|
||||
assert "response" in result
|
||||
assert len(result["response"]) > 0
|
||||
assert result["finished"] is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_session_not_found_raises(client):
|
||||
with pytest.raises(SessionNotFoundError):
|
||||
await client.get_session("non-existent-id")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_close_session(client):
|
||||
session = await client.create_session(user_id="tg-123", platform="telegram")
|
||||
result = await client.close_session(session["session_id"])
|
||||
|
||||
assert result is True
|
||||
|
||||
# Повторное закрытие — уже закрыта
|
||||
result2 = await client.close_session(session["session_id"])
|
||||
assert result2 is False
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_or_create_user(client):
|
||||
user = await client.get_or_create_user(
|
||||
external_id="12345",
|
||||
platform="telegram",
|
||||
display_name="Test User",
|
||||
)
|
||||
|
||||
assert user["user_id"].startswith("user-telegram-")
|
||||
assert user["external_id"] == "12345"
|
||||
assert user["platform"] == "telegram"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_message_history(client):
|
||||
session = await client.create_session(user_id="tg-123", platform="telegram")
|
||||
sid = session["session_id"]
|
||||
|
||||
await client.send_message(sid, "Первое сообщение")
|
||||
await client.send_message(sid, "Второе сообщение")
|
||||
|
||||
history = await client.get_message_history(sid, limit=10)
|
||||
assert len(history) == 2
|
||||
Loading…
Add table
Add a link
Reference in a new issue