Use is in enum comparison in config flow tests P-T (#114675)

This commit is contained in:
Joost Lekkerkerker 2024-04-02 23:21:50 +02:00 committed by GitHub
parent 5d500cb74b
commit ee66f6ec8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
164 changed files with 1919 additions and 1890 deletions

View file

@ -19,7 +19,7 @@ async def test_async_step_bluetooth_valid_device(hass: HomeAssistant) -> None:
context={"source": config_entries.SOURCE_BLUETOOTH},
data=HTPWX_SERVICE_INFO,
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "bluetooth_confirm"
with patch(
"homeassistant.components.sensorpush.async_setup_entry", return_value=True
@ -27,7 +27,7 @@ async def test_async_step_bluetooth_valid_device(hass: HomeAssistant) -> None:
result2 = await hass.config_entries.flow.async_configure(
result["flow_id"], user_input={}
)
assert result2["type"] == FlowResultType.CREATE_ENTRY
assert result2["type"] is FlowResultType.CREATE_ENTRY
assert result2["title"] == "HTP.xw F4D"
assert result2["data"] == {}
assert result2["result"].unique_id == "4125DDBA-2774-4851-9889-6AADDD4CAC3D"
@ -40,7 +40,7 @@ async def test_async_step_bluetooth_not_sensorpush(hass: HomeAssistant) -> None:
context={"source": config_entries.SOURCE_BLUETOOTH},
data=NOT_SENSOR_PUSH_SERVICE_INFO,
)
assert result["type"] == FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "not_supported"
@ -50,7 +50,7 @@ async def test_async_step_user_no_devices_found(hass: HomeAssistant) -> None:
DOMAIN,
context={"source": config_entries.SOURCE_USER},
)
assert result["type"] == FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "no_devices_found"
@ -64,7 +64,7 @@ async def test_async_step_user_with_found_devices(hass: HomeAssistant) -> None:
DOMAIN,
context={"source": config_entries.SOURCE_USER},
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
with patch(
"homeassistant.components.sensorpush.async_setup_entry", return_value=True
@ -73,7 +73,7 @@ async def test_async_step_user_with_found_devices(hass: HomeAssistant) -> None:
result["flow_id"],
user_input={"address": "61DE521B-F0BF-9F44-64D4-75BBE1738105"},
)
assert result2["type"] == FlowResultType.CREATE_ENTRY
assert result2["type"] is FlowResultType.CREATE_ENTRY
assert result2["title"] == "HT.w 0CA1"
assert result2["data"] == {}
assert result2["result"].unique_id == "61DE521B-F0BF-9F44-64D4-75BBE1738105"
@ -89,7 +89,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) -
DOMAIN,
context={"source": config_entries.SOURCE_USER},
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
entry = MockConfigEntry(
@ -105,7 +105,7 @@ async def test_async_step_user_device_added_between_steps(hass: HomeAssistant) -
result["flow_id"],
user_input={"address": "61DE521B-F0BF-9F44-64D4-75BBE1738105"},
)
assert result2["type"] == FlowResultType.ABORT
assert result2["type"] is FlowResultType.ABORT
assert result2["reason"] == "already_configured"
@ -127,7 +127,7 @@ async def test_async_step_user_with_found_devices_already_setup(
DOMAIN,
context={"source": config_entries.SOURCE_USER},
)
assert result["type"] == FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "no_devices_found"
@ -144,7 +144,7 @@ async def test_async_step_bluetooth_devices_already_setup(hass: HomeAssistant) -
context={"source": config_entries.SOURCE_BLUETOOTH},
data=HTW_SERVICE_INFO,
)
assert result["type"] == FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "already_configured"
@ -155,7 +155,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) ->
context={"source": config_entries.SOURCE_BLUETOOTH},
data=HTW_SERVICE_INFO,
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "bluetooth_confirm"
result = await hass.config_entries.flow.async_init(
@ -163,7 +163,7 @@ async def test_async_step_bluetooth_already_in_progress(hass: HomeAssistant) ->
context={"source": config_entries.SOURCE_BLUETOOTH},
data=HTW_SERVICE_INFO,
)
assert result["type"] == FlowResultType.ABORT
assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "already_in_progress"
@ -176,7 +176,7 @@ async def test_async_step_user_takes_precedence_over_discovery(
context={"source": config_entries.SOURCE_BLUETOOTH},
data=HTW_SERVICE_INFO,
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "bluetooth_confirm"
with patch(
@ -187,7 +187,7 @@ async def test_async_step_user_takes_precedence_over_discovery(
DOMAIN,
context={"source": config_entries.SOURCE_USER},
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
with patch(
"homeassistant.components.sensorpush.async_setup_entry", return_value=True
@ -196,7 +196,7 @@ async def test_async_step_user_takes_precedence_over_discovery(
result["flow_id"],
user_input={"address": "61DE521B-F0BF-9F44-64D4-75BBE1738105"},
)
assert result2["type"] == FlowResultType.CREATE_ENTRY
assert result2["type"] is FlowResultType.CREATE_ENTRY
assert result2["title"] == "HT.w 0CA1"
assert result2["data"] == {}
assert result2["result"].unique_id == "61DE521B-F0BF-9F44-64D4-75BBE1738105"