Change config entry state to an enum (#49654)
* Change config entry state to an enum * Allow but deprecate EntryState str equality comparison * Test fixes * Rename to ConfigEntryState * Remove str comparability backcompat * Update new occurrences of strs cropped up during review
This commit is contained in:
parent
0e7409e617
commit
19d25cd901
101 changed files with 557 additions and 688 deletions
|
@ -1,6 +1,6 @@
|
|||
"""Tests for the Plugwise Sensor integration."""
|
||||
|
||||
from homeassistant.config_entries import ENTRY_STATE_LOADED
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
|
||||
from tests.common import Mock
|
||||
from tests.components.plugwise.common import async_init_integration
|
||||
|
@ -9,7 +9,7 @@ from tests.components.plugwise.common import async_init_integration
|
|||
async def test_adam_climate_sensor_entities(hass, mock_smile_adam):
|
||||
"""Test creation of climate related sensor entities."""
|
||||
entry = await async_init_integration(hass, mock_smile_adam)
|
||||
assert entry.state == ENTRY_STATE_LOADED
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
state = hass.states.get("sensor.adam_outdoor_temperature")
|
||||
assert float(state.state) == 7.81
|
||||
|
@ -34,7 +34,7 @@ async def test_adam_climate_sensor_entities(hass, mock_smile_adam):
|
|||
async def test_anna_as_smt_climate_sensor_entities(hass, mock_smile_anna):
|
||||
"""Test creation of climate related sensor entities."""
|
||||
entry = await async_init_integration(hass, mock_smile_anna)
|
||||
assert entry.state == ENTRY_STATE_LOADED
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
state = hass.states.get("sensor.auxiliary_outdoor_temperature")
|
||||
assert float(state.state) == 18.0
|
||||
|
@ -50,7 +50,7 @@ async def test_anna_climate_sensor_entities(hass, mock_smile_anna):
|
|||
"""Test creation of climate related sensor entities as single master thermostat."""
|
||||
mock_smile_anna.single_master_thermostat.side_effect = Mock(return_value=False)
|
||||
entry = await async_init_integration(hass, mock_smile_anna)
|
||||
assert entry.state == ENTRY_STATE_LOADED
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
state = hass.states.get("sensor.auxiliary_outdoor_temperature")
|
||||
assert float(state.state) == 18.0
|
||||
|
@ -59,7 +59,7 @@ async def test_anna_climate_sensor_entities(hass, mock_smile_anna):
|
|||
async def test_p1_dsmr_sensor_entities(hass, mock_smile_p1):
|
||||
"""Test creation of power related sensor entities."""
|
||||
entry = await async_init_integration(hass, mock_smile_p1)
|
||||
assert entry.state == ENTRY_STATE_LOADED
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
state = hass.states.get("sensor.p1_net_electricity_point")
|
||||
assert float(state.state) == -2761.0
|
||||
|
@ -80,7 +80,7 @@ async def test_p1_dsmr_sensor_entities(hass, mock_smile_p1):
|
|||
async def test_stretch_sensor_entities(hass, mock_stretch):
|
||||
"""Test creation of power related sensor entities."""
|
||||
entry = await async_init_integration(hass, mock_stretch)
|
||||
assert entry.state == ENTRY_STATE_LOADED
|
||||
assert entry.state is ConfigEntryState.LOADED
|
||||
|
||||
state = hass.states.get("sensor.koelkast_92c4a_electricity_consumed")
|
||||
assert float(state.state) == 50.5
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue