Add type hints for MockAgent in conversation tests (#118701)

This commit is contained in:
epenet 2024-06-03 17:44:13 +02:00 committed by GitHub
parent f178467b0e
commit 5d594a509c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 8 deletions

View File

@ -138,6 +138,7 @@ _TEST_FIXTURES: dict[str, list[str] | str] = {
"mock_bleak_scanner_start": "MagicMock",
"mock_bluetooth": "None",
"mock_bluetooth_adapters": "None",
"mock_conversation_agent": "MockAgent",
"mock_device_tracker_conf": "list[Device]",
"mock_get_source_ip": "_patch",
"mock_hass_config": "None",

View File

@ -16,7 +16,7 @@ from tests.common import MockConfigEntry
@pytest.fixture
def mock_agent_support_all(hass: HomeAssistant):
def mock_agent_support_all(hass: HomeAssistant) -> MockAgent:
"""Mock agent that supports all languages."""
entry = MockConfigEntry(entry_id="mock-entry-support-all")
entry.add_to_hass(hass)

View File

@ -24,7 +24,7 @@ from homeassistant.helpers import (
)
from homeassistant.setup import async_setup_component
from . import expose_entity, expose_new
from . import MockAgent, expose_entity, expose_new
from tests.common import (
MockConfigEntry,
@ -94,7 +94,7 @@ async def test_http_processing_intent_target_ha_agent(
init_components,
hass_client: ClientSessionGenerator,
hass_admin_user: MockUser,
mock_conversation_agent,
mock_conversation_agent: MockAgent,
entity_registry: er.EntityRegistry,
snapshot: SnapshotAssertion,
) -> None:
@ -663,7 +663,7 @@ async def test_custom_agent(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_admin_user: MockUser,
mock_conversation_agent,
mock_conversation_agent: MockAgent,
snapshot: SnapshotAssertion,
) -> None:
"""Test a custom conversation agent."""
@ -1081,8 +1081,8 @@ async def test_agent_id_validator_invalid_agent(
async def test_get_agent_list(
hass: HomeAssistant,
init_components,
mock_conversation_agent,
mock_agent_support_all,
mock_conversation_agent: MockAgent,
mock_agent_support_all: MockAgent,
hass_ws_client: WebSocketGenerator,
snapshot: SnapshotAssertion,
) -> None:
@ -1139,7 +1139,7 @@ async def test_get_agent_list(
async def test_get_agent_info(
hass: HomeAssistant,
init_components,
mock_conversation_agent,
mock_conversation_agent: MockAgent,
snapshot: SnapshotAssertion,
) -> None:
"""Test get agent info."""

View File

@ -24,6 +24,7 @@ from homeassistant.setup import async_setup_component
from .const import CALL_SERVICE, FIRE_EVENT, REGISTER_CLEARTEXT, RENDER_TEMPLATE, UPDATE
from tests.common import async_capture_events, async_mock_service
from tests.components.conversation import MockAgent
@pytest.fixture
@ -1023,7 +1024,7 @@ async def test_webhook_handle_conversation_process(
homeassistant,
create_registrations,
webhook_client,
mock_conversation_agent,
mock_conversation_agent: MockAgent,
) -> None:
"""Test that we can converse."""
webhook_client.server.app.router._frozen = False