Files
voiceagent/tests/test_agent.py

44 lines
876 B
Python

import pytest
from voice_assistant.agent import MockAgentAdapter
@pytest.mark.anyio
async def test_mock_agent_process_text():
"""
Verify that the mock Agent returns the expected response.
"""
agent = MockAgentAdapter()
response = await agent.process(
session_id="session-1",
turn_id=1,
text="Qual o horário de funcionamento?",
)
assert response == (
"Resposta simulada para: "
"Qual o horário de funcionamento?"
)
@pytest.mark.anyio
async def test_mock_agent_records_call():
"""
Verify that the mock Agent records its invocation.
"""
agent = MockAgentAdapter()
await agent.process(
session_id="session-1",
turn_id=7,
text="Olá",
)
assert agent.calls == [
(
"session-1",
7,
"Olá",
)
]