1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

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:
Ville Skyttä
2021-05-20 20:19:20 +03:00
committed by GitHub
parent 0e7409e617
commit 19d25cd901
101 changed files with 557 additions and 688 deletions

View File

@@ -10,7 +10,7 @@ from homeassistant.components.openweathermap.const import (
DEFAULT_LANGUAGE,
DOMAIN,
)
from homeassistant.config_entries import SOURCE_USER
from homeassistant.config_entries import SOURCE_USER, ConfigEntryState
from homeassistant.const import (
CONF_API_KEY,
CONF_LATITUDE,
@@ -57,11 +57,11 @@ async def test_form(hass):
conf_entries = hass.config_entries.async_entries(DOMAIN)
entry = conf_entries[0]
assert entry.state == "loaded"
assert entry.state == ConfigEntryState.LOADED
await hass.config_entries.async_unload(conf_entries[0].entry_id)
await hass.async_block_till_done()
assert entry.state == "not_loaded"
assert entry.state == ConfigEntryState.NOT_LOADED
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["title"] == CONFIG[CONF_NAME]
@@ -86,7 +86,7 @@ async def test_form_options(hass):
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
assert config_entry.state == "loaded"
assert config_entry.state == ConfigEntryState.LOADED
result = await hass.config_entries.options.async_init(config_entry.entry_id)
@@ -105,7 +105,7 @@ async def test_form_options(hass):
await hass.async_block_till_done()
assert config_entry.state == "loaded"
assert config_entry.state == ConfigEntryState.LOADED
result = await hass.config_entries.options.async_init(config_entry.entry_id)
@@ -124,7 +124,7 @@ async def test_form_options(hass):
await hass.async_block_till_done()
assert config_entry.state == "loaded"
assert config_entry.state == ConfigEntryState.LOADED
async def test_form_invalid_api_key(hass):