mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Update h* tests to use entity & device registry fixtures (#103866)
* Update h* tests to use entity & device registry fixtures * Add missed lines
This commit is contained in:
committed by
GitHub
parent
3a531f5698
commit
eda475fe25
@@ -142,7 +142,9 @@ async def test_ecobee3_setup(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
async def test_ecobee3_setup_from_cache(
|
||||
hass: HomeAssistant, hass_storage: dict[str, Any]
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
hass_storage: dict[str, Any],
|
||||
) -> None:
|
||||
"""Test that Ecbobee can be correctly setup from its cached entity map."""
|
||||
accessories = await setup_accessories_from_file(hass, "ecobee3.json")
|
||||
@@ -163,8 +165,6 @@ async def test_ecobee3_setup_from_cache(
|
||||
|
||||
await setup_test_accessories(hass, accessories)
|
||||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
climate = entity_registry.async_get("climate.homew")
|
||||
assert climate.unique_id == "00:00:00:00:00:00_1_16"
|
||||
|
||||
@@ -178,12 +178,12 @@ async def test_ecobee3_setup_from_cache(
|
||||
assert occ3.unique_id == "00:00:00:00:00:00_4_56"
|
||||
|
||||
|
||||
async def test_ecobee3_setup_connection_failure(hass: HomeAssistant) -> None:
|
||||
async def test_ecobee3_setup_connection_failure(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
) -> None:
|
||||
"""Test that Ecbobee can be correctly setup from its cached entity map."""
|
||||
accessories = await setup_accessories_from_file(hass, "ecobee3.json")
|
||||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
# Test that the connection fails during initial setup.
|
||||
# No entities should be created.
|
||||
with mock.patch.object(FakePairing, "async_populate_accessories_state") as laac:
|
||||
@@ -218,9 +218,10 @@ async def test_ecobee3_setup_connection_failure(hass: HomeAssistant) -> None:
|
||||
assert occ3.unique_id == "00:00:00:00:00:00_4_56"
|
||||
|
||||
|
||||
async def test_ecobee3_add_sensors_at_runtime(hass: HomeAssistant) -> None:
|
||||
async def test_ecobee3_add_sensors_at_runtime(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
) -> None:
|
||||
"""Test that new sensors are automatically added."""
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
# Set up a base Ecobee 3 with no additional sensors.
|
||||
# There shouldn't be any entities but climate visible.
|
||||
@@ -254,9 +255,10 @@ async def test_ecobee3_add_sensors_at_runtime(hass: HomeAssistant) -> None:
|
||||
assert occ3.unique_id == "00:00:00:00:00:00_4_56"
|
||||
|
||||
|
||||
async def test_ecobee3_remove_sensors_at_runtime(hass: HomeAssistant) -> None:
|
||||
async def test_ecobee3_remove_sensors_at_runtime(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
) -> None:
|
||||
"""Test that sensors are automatically removed."""
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
# Set up a base Ecobee 3 with additional sensors.
|
||||
accessories = await setup_accessories_from_file(hass, "ecobee3.json")
|
||||
@@ -307,10 +309,9 @@ async def test_ecobee3_remove_sensors_at_runtime(hass: HomeAssistant) -> None:
|
||||
|
||||
|
||||
async def test_ecobee3_services_and_chars_removed(
|
||||
hass: HomeAssistant,
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
) -> None:
|
||||
"""Test handling removal of some services and chars."""
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
# Set up a base Ecobee 3 with additional sensors.
|
||||
accessories = await setup_accessories_from_file(hass, "ecobee3.json")
|
||||
|
||||
@@ -13,9 +13,10 @@ from ..common import (
|
||||
)
|
||||
|
||||
|
||||
async def test_fan_add_feature_at_runtime(hass: HomeAssistant) -> None:
|
||||
async def test_fan_add_feature_at_runtime(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
) -> None:
|
||||
"""Test that new features can be added at runtime."""
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
# Set up a basic fan that does not support oscillation
|
||||
accessories = await setup_accessories_from_file(
|
||||
@@ -55,9 +56,10 @@ async def test_fan_add_feature_at_runtime(hass: HomeAssistant) -> None:
|
||||
assert fan_state.attributes[ATTR_SUPPORTED_FEATURES] is FanEntityFeature.SET_SPEED
|
||||
|
||||
|
||||
async def test_fan_remove_feature_at_runtime(hass: HomeAssistant) -> None:
|
||||
async def test_fan_remove_feature_at_runtime(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
) -> None:
|
||||
"""Test that features can be removed at runtime."""
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
# Set up a basic fan that does not support oscillation
|
||||
accessories = await setup_accessories_from_file(
|
||||
@@ -97,9 +99,11 @@ async def test_fan_remove_feature_at_runtime(hass: HomeAssistant) -> None:
|
||||
assert fan_state.attributes[ATTR_SUPPORTED_FEATURES] is FanEntityFeature.SET_SPEED
|
||||
|
||||
|
||||
async def test_bridge_with_two_fans_one_removed(hass: HomeAssistant) -> None:
|
||||
async def test_bridge_with_two_fans_one_removed(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test a bridge with two fans and one gets removed."""
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
# Set up a basic fan that does not support oscillation
|
||||
accessories = await setup_accessories_from_file(
|
||||
|
||||
@@ -14,10 +14,12 @@ from ..common import (
|
||||
)
|
||||
|
||||
|
||||
async def test_vocolinc_vp3_setup(hass: HomeAssistant) -> None:
|
||||
async def test_vocolinc_vp3_setup(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test that a VOCOlinc VP3 can be correctly setup in HA."""
|
||||
|
||||
entity_registry = er.async_get(hass)
|
||||
outlet = entity_registry.async_get_or_create(
|
||||
"switch",
|
||||
"homekit_controller",
|
||||
|
||||
Reference in New Issue
Block a user