* Require config entry when setting Conversation agent, add new unset agent method * Remove onboarding from conversation agent * Type attribution * Wrap async_process params in ConversationInput object
25 lines
837 B
Python
25 lines
837 B
Python
"""Tests for the conversation component."""
|
|
from __future__ import annotations
|
|
|
|
from homeassistant.components import conversation
|
|
from homeassistant.helpers import intent
|
|
|
|
|
|
class MockAgent(conversation.AbstractConversationAgent):
|
|
"""Test Agent."""
|
|
|
|
def __init__(self) -> None:
|
|
"""Initialize the agent."""
|
|
self.calls = []
|
|
self.response = "Test response"
|
|
|
|
async def async_process(
|
|
self, user_input: conversation.ConversationInput
|
|
) -> conversation.ConversationResult:
|
|
"""Process some text."""
|
|
self.calls.append(user_input)
|
|
response = intent.IntentResponse(language=user_input.language)
|
|
response.async_set_speech(self.response)
|
|
return conversation.ConversationResult(
|
|
response=response, conversation_id=user_input.conversation_id
|
|
)
|