mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Use is in FlowResultType enum comparison in integration scaffold tests (#135133)
This commit is contained in:
parent
acbd501ede
commit
488c5a6b9f
@ -15,7 +15,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None:
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||||
)
|
)
|
||||||
assert result["type"] == FlowResultType.FORM
|
assert result["type"] is FlowResultType.FORM
|
||||||
assert result["errors"] == {}
|
assert result["errors"] == {}
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
@ -32,7 +32,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None:
|
|||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||||
assert result["title"] == "Name of the device"
|
assert result["title"] == "Name of the device"
|
||||||
assert result["data"] == {
|
assert result["data"] == {
|
||||||
CONF_HOST: "1.1.1.1",
|
CONF_HOST: "1.1.1.1",
|
||||||
@ -63,7 +63,7 @@ async def test_form_invalid_auth(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] == FlowResultType.FORM
|
assert result["type"] is FlowResultType.FORM
|
||||||
assert result["errors"] == {"base": "invalid_auth"}
|
assert result["errors"] == {"base": "invalid_auth"}
|
||||||
|
|
||||||
# Make sure the config flow tests finish with either an
|
# Make sure the config flow tests finish with either an
|
||||||
@ -83,7 +83,7 @@ async def test_form_invalid_auth(
|
|||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||||
assert result["title"] == "Name of the device"
|
assert result["title"] == "Name of the device"
|
||||||
assert result["data"] == {
|
assert result["data"] == {
|
||||||
CONF_HOST: "1.1.1.1",
|
CONF_HOST: "1.1.1.1",
|
||||||
@ -114,7 +114,7 @@ async def test_form_cannot_connect(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] == FlowResultType.FORM
|
assert result["type"] is FlowResultType.FORM
|
||||||
assert result["errors"] == {"base": "cannot_connect"}
|
assert result["errors"] == {"base": "cannot_connect"}
|
||||||
|
|
||||||
# Make sure the config flow tests finish with either an
|
# Make sure the config flow tests finish with either an
|
||||||
@ -135,7 +135,7 @@ async def test_form_cannot_connect(
|
|||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||||
assert result["title"] == "Name of the device"
|
assert result["title"] == "Name of the device"
|
||||||
assert result["data"] == {
|
assert result["data"] == {
|
||||||
CONF_HOST: "1.1.1.1",
|
CONF_HOST: "1.1.1.1",
|
||||||
|
@ -24,7 +24,7 @@ async def test_config_flow(
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||||
)
|
)
|
||||||
assert result["type"] == FlowResultType.FORM
|
assert result["type"] is FlowResultType.FORM
|
||||||
assert result["errors"] is None
|
assert result["errors"] is None
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_configure(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
@ -33,7 +33,7 @@ async def test_config_flow(
|
|||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||||
assert result["title"] == "My NEW_DOMAIN"
|
assert result["title"] == "My NEW_DOMAIN"
|
||||||
assert result["data"] == {}
|
assert result["data"] == {}
|
||||||
assert result["options"] == {
|
assert result["options"] == {
|
||||||
@ -83,7 +83,7 @@ async def test_options(hass: HomeAssistant, platform) -> None:
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||||
assert result["type"] == FlowResultType.FORM
|
assert result["type"] is FlowResultType.FORM
|
||||||
assert result["step_id"] == "init"
|
assert result["step_id"] == "init"
|
||||||
schema = result["data_schema"].schema
|
schema = result["data_schema"].schema
|
||||||
assert get_suggested(schema, "entity_id") == input_sensor_1_entity_id
|
assert get_suggested(schema, "entity_id") == input_sensor_1_entity_id
|
||||||
@ -94,7 +94,7 @@ async def test_options(hass: HomeAssistant, platform) -> None:
|
|||||||
"entity_id": input_sensor_2_entity_id,
|
"entity_id": input_sensor_2_entity_id,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||||
assert result["data"] == {
|
assert result["data"] == {
|
||||||
"entity_id": input_sensor_2_entity_id,
|
"entity_id": input_sensor_2_entity_id,
|
||||||
"name": "My NEW_DOMAIN",
|
"name": "My NEW_DOMAIN",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user