1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add test helper for starting reconfiguration flow (#127154)

This commit is contained in:
epenet
2024-10-01 12:18:07 +02:00
committed by GitHub
parent f02f0eae59
commit b95dfe2b00
3 changed files with 70 additions and 8 deletions

View File

@@ -1066,6 +1066,25 @@ class MockConfigEntry(config_entries.ConfigEntry):
"""Start a reauthentication flow."""
return await start_reauth_flow(hass, self, context, data)
async def start_reconfigure_flow(
self,
hass: HomeAssistant,
context: dict[str, Any] | None = None,
data: dict[str, Any] | None = None,
) -> ConfigFlowResult:
"""Start a reconfiguration flow."""
return await hass.config_entries.flow.async_init(
self.domain,
context={
"source": config_entries.SOURCE_RECONFIGURE,
"entry_id": self.entry_id,
"title_placeholders": {"name": self.title},
"unique_id": self.unique_id,
}
| (context or {}),
data=self.data | (data or {}),
)
async def start_reauth_flow(
hass: HomeAssistant,