2023-01-19 18:59:02 +00:00
|
|
|
"""Conversation test helpers."""
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
from homeassistant.components import conversation
|
2023-04-22 16:43:09 +00:00
|
|
|
from homeassistant.const import MATCH_ALL
|
2023-01-19 18:59:02 +00:00
|
|
|
|
|
|
|
from . import MockAgent
|
|
|
|
|
2023-02-04 04:35:29 +00:00
|
|
|
from tests.common import MockConfigEntry
|
|
|
|
|
2023-01-19 18:59:02 +00:00
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def mock_agent(hass):
|
|
|
|
"""Mock agent."""
|
2023-02-04 04:35:29 +00:00
|
|
|
entry = MockConfigEntry(entry_id="mock-entry")
|
|
|
|
entry.add_to_hass(hass)
|
2023-04-22 16:43:09 +00:00
|
|
|
agent = MockAgent(entry.entry_id, ["smurfish"])
|
|
|
|
conversation.async_set_agent(hass, entry, agent)
|
|
|
|
return agent
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def mock_agent_support_all(hass):
|
|
|
|
"""Mock agent that supports all languages."""
|
|
|
|
entry = MockConfigEntry(entry_id="mock-entry-support-all")
|
|
|
|
entry.add_to_hass(hass)
|
|
|
|
agent = MockAgent(entry.entry_id, MATCH_ALL)
|
2023-02-04 04:35:29 +00:00
|
|
|
conversation.async_set_agent(hass, entry, agent)
|
2023-01-19 18:59:02 +00:00
|
|
|
return agent
|