Add tests to myuplink binary_sensor (#110995)

This commit is contained in:
Åke Strandberg 2024-02-21 12:32:25 +01:00 committed by GitHub
parent 05b23c2e7b
commit 2614d6fece
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 1 deletions

View File

@ -1708,7 +1708,6 @@ omit =
homeassistant/components/myuplink/__init__.py homeassistant/components/myuplink/__init__.py
homeassistant/components/myuplink/api.py homeassistant/components/myuplink/api.py
homeassistant/components/myuplink/application_credentials.py homeassistant/components/myuplink/application_credentials.py
homeassistant/components/myuplink/binary_sensor.py
homeassistant/components/myuplink/coordinator.py homeassistant/components/myuplink/coordinator.py
homeassistant/components/myuplink/entity.py homeassistant/components/myuplink/entity.py
homeassistant/components/myuplink/helpers.py homeassistant/components/myuplink/helpers.py

View File

@ -0,0 +1,25 @@
"""Tests for myuplink sensor module."""
from unittest.mock import MagicMock
from homeassistant.core import HomeAssistant
from . import setup_integration
from tests.common import MockConfigEntry
async def test_sensor_states(
hass: HomeAssistant,
mock_myuplink_client: MagicMock,
mock_config_entry: MockConfigEntry,
) -> None:
"""Test sensor state."""
await setup_integration(hass, mock_config_entry)
state = hass.states.get("binary_sensor.f730_cu_3x400v_pump_heating_medium_gp1")
assert state is not None
assert state.state == "on"
assert state.attributes == {
"friendly_name": "F730 CU 3x400V Pump: Heating medium (GP1)",
}