Use is in enum comparison in config flow tests P-T (#114675)
This commit is contained in:
parent
5d500cb74b
commit
ee66f6ec8c
164 changed files with 1919 additions and 1890 deletions
|
@ -35,7 +35,7 @@ async def test_show_user_form(hass: HomeAssistant) -> None:
|
|||
)
|
||||
|
||||
assert result["step_id"] == "user"
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
|
||||
|
||||
async def test_cannot_connect(
|
||||
|
@ -50,7 +50,7 @@ async def test_cannot_connect(
|
|||
data=MOCK_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
@ -64,7 +64,7 @@ async def test_invalid_auth(
|
|||
DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data=MOCK_USER_INPUT
|
||||
)
|
||||
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
@ -81,7 +81,7 @@ async def test_wrong_app(hass: HomeAssistant) -> None:
|
|||
data={CONF_URL: URL, CONF_VERIFY_SSL: False},
|
||||
)
|
||||
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"]["base"] == "wrong_app"
|
||||
|
||||
|
@ -98,7 +98,7 @@ async def test_zero_conf_failure(hass: HomeAssistant) -> None:
|
|||
data={CONF_URL: URL, CONF_VERIFY_SSL: False},
|
||||
)
|
||||
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"]["base"] == "zeroconf_failed"
|
||||
|
||||
|
@ -115,7 +115,7 @@ async def test_unknown_error(hass: HomeAssistant) -> None:
|
|||
data=MOCK_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": "unknown"}
|
||||
|
||||
|
@ -132,7 +132,7 @@ async def test_zero_conf(hass: HomeAssistant) -> None:
|
|||
data={CONF_URL: URL, CONF_VERIFY_SSL: False},
|
||||
)
|
||||
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == DEFAULT_NAME
|
||||
assert result["data"] == CONF_DATA
|
||||
|
||||
|
@ -153,14 +153,14 @@ async def test_full_reauth_flow_implementation(
|
|||
data=entry.data,
|
||||
)
|
||||
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth_confirm"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
with patch_async_setup_entry() as mock_setup_entry:
|
||||
|
@ -169,7 +169,7 @@ async def test_full_reauth_flow_implementation(
|
|||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "reauth_successful"
|
||||
|
||||
assert entry.data == CONF_DATA | {CONF_API_KEY: "test-api-key-reauth"}
|
||||
|
@ -188,7 +188,7 @@ async def test_full_user_flow_implementation(
|
|||
context={CONF_SOURCE: SOURCE_USER},
|
||||
)
|
||||
|
||||
assert result["type"] == FlowResultType.FORM
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
with patch_async_setup_entry():
|
||||
|
@ -197,7 +197,7 @@ async def test_full_user_flow_implementation(
|
|||
user_input=MOCK_USER_INPUT,
|
||||
)
|
||||
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == DEFAULT_NAME
|
||||
assert result["data"] == CONF_DATA
|
||||
assert result["data"][CONF_URL] == "http://192.168.1.189:7887/test"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue