1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-02 08:26:41 +01:00

Mock async_setup_entry in tautulli config flow tests (#164388)

This commit is contained in:
Franck Nijhof
2026-02-27 20:30:38 +01:00
committed by GitHub
parent 4f05c807b0
commit 97bcea9727

View File

@@ -25,12 +25,15 @@ async def test_flow_user(hass: HomeAssistant) -> None:
assert result["step_id"] == "user"
assert result["errors"] == {}
with patch_config_flow_tautulli(AsyncMock()):
with (
patch_config_flow_tautulli(AsyncMock()),
patch("homeassistant.components.tautulli.async_setup_entry", return_value=True),
):
result2 = await hass.config_entries.flow.async_configure(
result["flow_id"],
user_input=CONF_DATA,
)
await hass.async_block_till_done()
await hass.async_block_till_done()
assert result2["type"] is FlowResultType.CREATE_ENTRY
assert result2["title"] == NAME
@@ -48,12 +51,15 @@ async def test_flow_user_cannot_connect(hass: HomeAssistant) -> None:
assert result["step_id"] == "user"
assert result["errors"]["base"] == "cannot_connect"
with patch_config_flow_tautulli(AsyncMock()):
with (
patch_config_flow_tautulli(AsyncMock()),
patch("homeassistant.components.tautulli.async_setup_entry", return_value=True),
):
result2 = await hass.config_entries.flow.async_configure(
result["flow_id"],
user_input=CONF_DATA,
)
await hass.async_block_till_done()
await hass.async_block_till_done()
assert result2["type"] is FlowResultType.CREATE_ENTRY
assert result2["title"] == NAME
@@ -71,12 +77,15 @@ async def test_flow_user_invalid_auth(hass: HomeAssistant) -> None:
assert result["step_id"] == "user"
assert result["errors"]["base"] == "invalid_auth"
with patch_config_flow_tautulli(AsyncMock()):
with (
patch_config_flow_tautulli(AsyncMock()),
patch("homeassistant.components.tautulli.async_setup_entry", return_value=True),
):
result2 = await hass.config_entries.flow.async_configure(
result["flow_id"],
user_input=CONF_DATA,
)
await hass.async_block_till_done()
await hass.async_block_till_done()
assert result2["type"] is FlowResultType.CREATE_ENTRY
assert result2["title"] == NAME
@@ -94,12 +103,15 @@ async def test_flow_user_unknown_error(hass: HomeAssistant) -> None:
assert result["step_id"] == "user"
assert result["errors"]["base"] == "unknown"
with patch_config_flow_tautulli(AsyncMock()):
with (
patch_config_flow_tautulli(AsyncMock()),
patch("homeassistant.components.tautulli.async_setup_entry", return_value=True),
):
result2 = await hass.config_entries.flow.async_configure(
result["flow_id"],
user_input=CONF_DATA,
)
await hass.async_block_till_done()
await hass.async_block_till_done()
assert result2["type"] is FlowResultType.CREATE_ENTRY
assert result2["title"] == NAME
@@ -138,12 +150,15 @@ async def test_flow_user_multiple_entries_allowed(hass: HomeAssistant) -> None:
CONF_API_KEY: "efgh",
CONF_VERIFY_SSL: True,
}
with patch_config_flow_tautulli(AsyncMock()):
with (
patch_config_flow_tautulli(AsyncMock()),
patch("homeassistant.components.tautulli.async_setup_entry", return_value=True),
):
result2 = await hass.config_entries.flow.async_configure(
result["flow_id"],
user_input=user_input,
)
await hass.async_block_till_done()
await hass.async_block_till_done()
assert result2["type"] is FlowResultType.CREATE_ENTRY
assert result2["title"] == NAME