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

@@ -5,7 +5,7 @@ import logging
import blebox_uniapi
from homeassistant.components.blebox.const import DOMAIN
from homeassistant.config_entries import ENTRY_STATE_NOT_LOADED, ENTRY_STATE_SETUP_RETRY
from homeassistant.config_entries import ConfigEntryState
from .conftest import mock_config, patch_product_identify
@@ -23,7 +23,7 @@ async def test_setup_failure(hass, caplog):
await hass.async_block_till_done()
assert "Identify failed at 172.100.123.4:80 ()" in caplog.text
assert entry.state == ENTRY_STATE_SETUP_RETRY
assert entry.state is ConfigEntryState.SETUP_RETRY
async def test_setup_failure_on_connection(hass, caplog):
@@ -39,7 +39,7 @@ async def test_setup_failure_on_connection(hass, caplog):
await hass.async_block_till_done()
assert "Identify failed at 172.100.123.4:80 ()" in caplog.text
assert entry.state == ENTRY_STATE_SETUP_RETRY
assert entry.state is ConfigEntryState.SETUP_RETRY
async def test_unload_config_entry(hass):
@@ -57,4 +57,4 @@ async def test_unload_config_entry(hass):
await hass.async_block_till_done()
assert not hass.data.get(DOMAIN)
assert entry.state == ENTRY_STATE_NOT_LOADED
assert entry.state is ConfigEntryState.NOT_LOADED