mirror of
https://github.com/home-assistant/core.git
synced 2026-04-28 04:33:49 +01:00
Remove EntityComponent.async_register_legacy_entity_service (#152539)
This commit is contained in:
@@ -694,40 +694,6 @@ async def test_register_entity_service_response_data_multiple_matches_raises(
|
||||
)
|
||||
|
||||
|
||||
async def test_legacy_register_entity_service_response_data_multiple_matches(
|
||||
hass: HomeAssistant,
|
||||
) -> None:
|
||||
"""Test asking for legacy service response data but matching many entities."""
|
||||
entity1 = MockEntity(entity_id=f"{DOMAIN}.entity1")
|
||||
entity2 = MockEntity(entity_id=f"{DOMAIN}.entity2")
|
||||
|
||||
async def generate_response(
|
||||
target: MockEntity, call: ServiceCall
|
||||
) -> ServiceResponse:
|
||||
return {"response-key": "response-value"}
|
||||
|
||||
component = EntityComponent(_LOGGER, DOMAIN, hass)
|
||||
await component.async_setup({})
|
||||
await component.async_add_entities([entity1, entity2])
|
||||
|
||||
component.async_register_legacy_entity_service(
|
||||
"hello",
|
||||
{"some": str},
|
||||
generate_response,
|
||||
supports_response=SupportsResponse.ONLY,
|
||||
)
|
||||
|
||||
with pytest.raises(HomeAssistantError, match="matched more than one entity"):
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
"hello",
|
||||
service_data={"some": "data"},
|
||||
target={"entity_id": [entity1.entity_id, entity2.entity_id]},
|
||||
blocking=True,
|
||||
return_response=True,
|
||||
)
|
||||
|
||||
|
||||
async def test_platforms_shutdown_on_stop(hass: HomeAssistant) -> None:
|
||||
"""Test that we shutdown platforms on stop."""
|
||||
platform1_setup = Mock(side_effect=[PlatformNotReady, PlatformNotReady, None])
|
||||
|
||||
Reference in New Issue
Block a user