Small cleanup in HomeWizard tests (#103837)

pull/103835/head^2
Franck Nijhof 2023-11-12 11:38:22 +01:00 committed by GitHub
parent 81450f0117
commit 5a452155fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 24 deletions

View File

@ -116,6 +116,16 @@ async def test_sensors(
"sensor.device_active_frequency",
],
),
(
"HWE-P1-unused-exports",
[
"sensor.device_total_energy_export",
"sensor.device_total_energy_export_tariff_1",
"sensor.device_total_energy_export_tariff_2",
"sensor.device_total_energy_export_tariff_3",
"sensor.device_total_energy_export_tariff_4",
],
),
(
"HWE-WTR",
[
@ -136,30 +146,6 @@ async def test_disabled_by_default_sensors(
assert entry.disabled_by is er.RegistryEntryDisabler.INTEGRATION
@pytest.mark.parametrize("device_fixture", ["HWE-P1-unused-exports"])
@pytest.mark.parametrize(
"entity_id",
[
"sensor.device_total_energy_export",
"sensor.device_total_energy_export_tariff_1",
"sensor.device_total_energy_export_tariff_2",
"sensor.device_total_energy_export_tariff_3",
"sensor.device_total_energy_export_tariff_4",
],
)
async def test_disabled_by_default_sensors_when_unused(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,
entity_id: str,
) -> None:
"""Test the disabled by default unused sensors."""
assert not hass.states.get(entity_id)
assert (entry := entity_registry.async_get(entity_id))
assert entry.disabled
assert entry.disabled_by is er.RegistryEntryDisabler.INTEGRATION
@pytest.mark.parametrize("exception", [RequestError, DisabledError])
async def test_sensors_unreachable(
hass: HomeAssistant,