Files
homeassistant-core/tests/components/rainmachine/test_diagnostics.py
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.1 KiB
Python
Raw Normal View History

2022-01-24 03:10:42 -07:00
"""Test RainMachine diagnostics."""
2022-08-07 15:21:49 -06:00
from regenmaschine.errors import RainMachineError
from syrupy import SnapshotAssertion
2022-08-07 15:21:49 -06:00
from homeassistant.core import HomeAssistant
2022-01-24 03:10:42 -07:00
from tests.components.diagnostics import get_diagnostics_for_config_entry
from tests.typing import ClientSessionGenerator
2022-01-24 03:10:42 -07:00
async def test_entry_diagnostics(
hass: HomeAssistant,
config_entry,
hass_client: ClientSessionGenerator,
setup_rainmachine,
snapshot: SnapshotAssertion,
) -> None:
2022-01-24 03:10:42 -07:00
"""Test config entry diagnostics."""
assert (
await get_diagnostics_for_config_entry(hass, hass_client, config_entry)
== snapshot
)
2022-08-07 15:21:49 -06:00
async def test_entry_diagnostics_failed_controller_diagnostics(
hass: HomeAssistant,
config_entry,
controller,
hass_client: ClientSessionGenerator,
setup_rainmachine,
snapshot: SnapshotAssertion,
) -> None:
2022-08-07 15:21:49 -06:00
"""Test config entry diagnostics when the controller diagnostics API call fails."""
controller.diagnostics.current.side_effect = RainMachineError
assert (
await get_diagnostics_for_config_entry(hass, hass_client, config_entry)
== snapshot
)