Files
core/tests/components/conversation/__init__.py
T
Michael Hansen ea95abcb30 Use intent responses from home-assistant-intents (#86484)
* Use intent responses from home_assistant_intents

* Use error responses from home_assistant_intents

* Remove speech checks for intent tests (set by conversation now)

* Bump hassil and home-assistant-intents versions

* Use Home Assistant JSON reader when loading intents

* Remove speech checks for light tests (done in agent)

* Add more tests for code coverage

* Add test for reloading on new component

* Add test for non-default response
2023-01-23 22:38:41 -05:00

31 lines
969 B
Python

"""Tests for the conversation component."""
from __future__ import annotations
from homeassistant.components import conversation
from homeassistant.core import Context
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,
text: str,
context: Context,
conversation_id: str | None = None,
language: str | None = None,
) -> conversation.ConversationResult:
"""Process some text."""
self.calls.append((text, context, conversation_id, language))
response = intent.IntentResponse(language=language)
response.async_set_speech(self.response)
return conversation.ConversationResult(
response=response, conversation_id=conversation_id
)