1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +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

@@ -13,9 +13,9 @@ from tests.common import MockConfigEntry
@pytest.mark.parametrize(
"first_con, second_con,exp_type, exp_result, exp_reason",
[
(True, True, "create_entry", "loaded", ""),
(False, False, "abort", "", "no_connection"),
(True, False, "create_entry", "setup_retry", ""),
(True, True, "create_entry", config_entries.ConfigEntryState.LOADED, ""),
(False, False, "abort", None, "no_connection"),
(True, False, "create_entry", config_entries.ConfigEntryState.SETUP_RETRY, ""),
],
)
async def test_flow(hass, first_con, second_con, exp_type, exp_result, exp_reason):
@@ -104,4 +104,4 @@ async def test_two_entries(hass):
data={dynalite.CONF_HOST: host2},
)
assert result["type"] == "create_entry"
assert result["result"].state == "loaded"
assert result["result"].state == config_entries.ConfigEntryState.LOADED