From 3385151c269febdfcc2a4e43d36b0612500ff535 Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Wed, 3 Sep 2025 09:46:57 -0700 Subject: [PATCH] Test for async_show_menu sort (#151630) --- tests/test_data_entry_flow.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/test_data_entry_flow.py b/tests/test_data_entry_flow.py index f0912188b9e9..55ff79e25310 100644 --- a/tests/test_data_entry_flow.py +++ b/tests/test_data_entry_flow.py @@ -1071,13 +1071,19 @@ async def test_manager_abort_calls_async_flow_removed(manager: MockFlowManager) @pytest.mark.parametrize( - "menu_options", - [["target1", "target2"], {"target1": "Target 1", "target2": "Target 2"}], + ("menu_options", "sort", "expect_sort"), + [ + (["target1", "target2"], None, None), + ({"target1": "Target 1", "target2": "Target 2"}, False, None), + (["target2", "target1"], True, True), + ], ) async def test_show_menu( hass: HomeAssistant, manager: MockFlowManager, menu_options: list[str] | dict[str, str], + sort: bool | None, + expect_sort: bool | None, ) -> None: """Test show menu.""" manager.hass = hass @@ -1093,6 +1099,7 @@ async def test_show_menu( step_id="init", menu_options=menu_options, description_placeholders={"name": "Paulus"}, + sort=sort, ) async def async_step_target1(self, user_input=None): @@ -1105,6 +1112,7 @@ async def test_show_menu( assert result["type"] == data_entry_flow.FlowResultType.MENU assert result["menu_options"] == menu_options assert result["description_placeholders"] == {"name": "Paulus"} + assert result.get("sort") == expect_sort assert len(manager.async_progress()) == 1 assert len(manager.async_progress_by_handler("test")) == 1 assert manager.async_get(result["flow_id"])["handler"] == "test"