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
164 changed files with 1919 additions and 1890 deletions

View File

@@ -49,7 +49,7 @@ async def test_form(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["step_id"] == "user"
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
with patch(
"homeassistant.components.rest.RestData",
@@ -75,7 +75,7 @@ async def test_form(
)
await hass.async_block_till_done()
assert result3["type"] == FlowResultType.CREATE_ENTRY
assert result3["type"] is FlowResultType.CREATE_ENTRY
assert result3["version"] == 1
assert result3["options"] == {
CONF_RESOURCE: "https://www.home-assistant.io",
@@ -106,7 +106,7 @@ async def test_form_with_post(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["step_id"] == "user"
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
with patch(
"homeassistant.components.rest.RestData",
@@ -133,7 +133,7 @@ async def test_form_with_post(
)
await hass.async_block_till_done()
assert result3["type"] == FlowResultType.CREATE_ENTRY
assert result3["type"] is FlowResultType.CREATE_ENTRY
assert result3["version"] == 1
assert result3["options"] == {
CONF_RESOURCE: "https://www.home-assistant.io",
@@ -165,7 +165,7 @@ async def test_flow_fails(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == config_entries.SOURCE_USER
with patch(
@@ -224,7 +224,7 @@ async def test_flow_fails(
)
await hass.async_block_till_done()
assert result4["type"] == FlowResultType.CREATE_ENTRY
assert result4["type"] is FlowResultType.CREATE_ENTRY
assert result4["title"] == "https://www.home-assistant.io"
assert result4["options"] == {
CONF_RESOURCE: "https://www.home-assistant.io",
@@ -253,7 +253,7 @@ async def test_options_resource_flow(
result = await hass.config_entries.options.async_init(loaded_entry.entry_id)
assert result["type"] == FlowResultType.MENU
assert result["type"] is FlowResultType.MENU
assert result["step_id"] == "init"
result = await hass.config_entries.options.async_configure(
@@ -261,7 +261,7 @@ async def test_options_resource_flow(
{"next_step_id": "resource"},
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "resource"
mocker = MockRestData("test_scrape_sensor2")
@@ -280,7 +280,7 @@ async def test_options_resource_flow(
)
await hass.async_block_till_done()
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["data"] == {
CONF_RESOURCE: "https://www.home-assistant.io",
CONF_METHOD: "GET",
@@ -319,7 +319,7 @@ async def test_options_add_remove_sensor_flow(
result = await hass.config_entries.options.async_init(loaded_entry.entry_id)
assert result["type"] == FlowResultType.MENU
assert result["type"] is FlowResultType.MENU
assert result["step_id"] == "init"
result = await hass.config_entries.options.async_configure(
@@ -327,7 +327,7 @@ async def test_options_add_remove_sensor_flow(
{"next_step_id": "add_sensor"},
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "add_sensor"
mocker = MockRestData("test_scrape_sensor2")
@@ -348,7 +348,7 @@ async def test_options_add_remove_sensor_flow(
)
await hass.async_block_till_done()
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["data"] == {
CONF_RESOURCE: "https://www.home-assistant.io",
CONF_METHOD: "GET",
@@ -387,7 +387,7 @@ async def test_options_add_remove_sensor_flow(
result = await hass.config_entries.options.async_init(loaded_entry.entry_id)
assert result["type"] == FlowResultType.MENU
assert result["type"] is FlowResultType.MENU
assert result["step_id"] == "init"
result = await hass.config_entries.options.async_configure(
@@ -395,7 +395,7 @@ async def test_options_add_remove_sensor_flow(
{"next_step_id": "remove_sensor"},
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "remove_sensor"
mocker = MockRestData("test_scrape_sensor2")
@@ -408,7 +408,7 @@ async def test_options_add_remove_sensor_flow(
)
await hass.async_block_till_done()
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["data"] == {
CONF_RESOURCE: "https://www.home-assistant.io",
CONF_METHOD: "GET",
@@ -445,7 +445,7 @@ async def test_options_edit_sensor_flow(
result = await hass.config_entries.options.async_init(loaded_entry.entry_id)
assert result["type"] == FlowResultType.MENU
assert result["type"] is FlowResultType.MENU
assert result["step_id"] == "init"
result = await hass.config_entries.options.async_configure(
@@ -453,7 +453,7 @@ async def test_options_edit_sensor_flow(
{"next_step_id": "select_edit_sensor"},
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "select_edit_sensor"
result = await hass.config_entries.options.async_configure(
@@ -461,7 +461,7 @@ async def test_options_edit_sensor_flow(
{"index": "0"},
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "edit_sensor"
mocker = MockRestData("test_scrape_sensor2")
@@ -475,7 +475,7 @@ async def test_options_edit_sensor_flow(
)
await hass.async_block_till_done()
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["data"] == {
CONF_RESOURCE: "https://www.home-assistant.io",
CONF_METHOD: "GET",
@@ -529,21 +529,21 @@ async def test_sensor_options_add_device_class(
entry.add_to_hass(hass)
result = await hass.config_entries.options.async_init(entry.entry_id)
assert result["type"] == FlowResultType.MENU
assert result["type"] is FlowResultType.MENU
assert result["step_id"] == "init"
result = await hass.config_entries.options.async_configure(
result["flow_id"],
{"next_step_id": "select_edit_sensor"},
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "select_edit_sensor"
result = await hass.config_entries.options.async_configure(
result["flow_id"],
{"index": "0"},
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "edit_sensor"
result = await hass.config_entries.options.async_configure(
@@ -559,7 +559,7 @@ async def test_sensor_options_add_device_class(
)
await hass.async_block_till_done()
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["data"] == {
CONF_RESOURCE: "https://www.home-assistant.io",
CONF_METHOD: "GET",
@@ -611,21 +611,21 @@ async def test_sensor_options_remove_device_class(
entry.add_to_hass(hass)
result = await hass.config_entries.options.async_init(entry.entry_id)
assert result["type"] == FlowResultType.MENU
assert result["type"] is FlowResultType.MENU
assert result["step_id"] == "init"
result = await hass.config_entries.options.async_configure(
result["flow_id"],
{"next_step_id": "select_edit_sensor"},
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "select_edit_sensor"
result = await hass.config_entries.options.async_configure(
result["flow_id"],
{"index": "0"},
)
assert result["type"] == FlowResultType.FORM
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "edit_sensor"
result = await hass.config_entries.options.async_configure(
@@ -638,7 +638,7 @@ async def test_sensor_options_remove_device_class(
)
await hass.async_block_till_done()
assert result["type"] == FlowResultType.CREATE_ENTRY
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["data"] == {
CONF_RESOURCE: "https://www.home-assistant.io",
CONF_METHOD: "GET",