Remove config entry specifics from FlowManager (#85565)

This commit is contained in:
Erik Montnemery 2023-01-17 15:26:17 +01:00 committed by GitHub
parent 0f3221eac7
commit 3cd6bd87a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 119 additions and 85 deletions

View file

@ -1,5 +1,4 @@
"""Test the flow classes."""
import asyncio
import logging
from unittest.mock import Mock, patch
@ -181,7 +180,7 @@ async def test_abort_calls_async_remove_with_exception(manager, caplog):
with caplog.at_level(logging.ERROR):
await manager.async_init("test")
assert "Error removing test config flow: error" in caplog.text
assert "Error removing test flow: error" in caplog.text
TestFlow.async_remove.assert_called_once()
@ -419,22 +418,6 @@ async def test_abort_flow_exception(manager):
assert form["description_placeholders"] == {"placeholder": "yo"}
async def test_initializing_flows_canceled_on_shutdown(hass, manager):
"""Test that initializing flows are canceled on shutdown."""
@manager.mock_reg_handler("test")
class TestFlow(data_entry_flow.FlowHandler):
async def async_step_init(self, user_input=None):
await asyncio.sleep(1)
task = asyncio.create_task(manager.async_init("test"))
await hass.async_block_till_done()
await manager.async_shutdown()
with pytest.raises(asyncio.exceptions.CancelledError):
await task
async def test_init_unknown_flow(manager):
"""Test that UnknownFlow is raised when async_create_flow returns None."""