Files
homeassistant-core/tests/components/ipma/test_sensor.py
T

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

38 lines
1.2 KiB
Python
Raw Normal View History

2023-06-27 15:00:10 +01:00
"""The sensor tests for the IPMA platform."""
from unittest.mock import patch
from homeassistant.core import HomeAssistant
2023-06-27 15:00:10 +01:00
from . import ENTRY_CONFIG, MockLocation
from tests.common import MockConfigEntry
async def test_ipma_fire_risk_create_sensors(hass: HomeAssistant) -> None:
2023-06-27 15:00:10 +01:00
"""Test creation of fire risk sensors."""
2023-09-27 16:45:21 +01:00
with patch("pyipma.location.Location.get", return_value=MockLocation()):
2023-06-27 15:00:10 +01:00
entry = MockConfigEntry(domain="ipma", data=ENTRY_CONFIG)
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
state = hass.states.get("sensor.hometown_fire_risk")
assert state.state == "3"
2023-09-27 16:45:21 +01:00
async def test_ipma_uv_index_create_sensors(hass: HomeAssistant) -> None:
2023-09-27 16:45:21 +01:00
"""Test creation of uv index sensors."""
with patch("pyipma.location.Location.get", return_value=MockLocation()):
entry = MockConfigEntry(domain="ipma", data=ENTRY_CONFIG)
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
state = hass.states.get("sensor.hometown_uv_index")
assert state.state == "6"