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

@@ -4,7 +4,7 @@ from unittest.mock import patch
from pydexcom import AccountError, SessionError
from homeassistant.components.dexcom.const import DOMAIN
from homeassistant.config_entries import ENTRY_STATE_LOADED, ENTRY_STATE_NOT_LOADED
from homeassistant.config_entries import ConfigEntryState
from tests.common import MockConfigEntry
from tests.components.dexcom import CONFIG, init_integration
@@ -55,10 +55,10 @@ async def test_unload_entry(hass):
entry = await init_integration(hass)
assert len(hass.config_entries.async_entries(DOMAIN)) == 1
assert entry.state == ENTRY_STATE_LOADED
assert entry.state is ConfigEntryState.LOADED
assert await hass.config_entries.async_unload(entry.entry_id)
await hass.async_block_till_done()
assert entry.state == ENTRY_STATE_NOT_LOADED
assert entry.state is ConfigEntryState.NOT_LOADED
assert not hass.data.get(DOMAIN)