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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user