@@ -54,6 +54,38 @@ async def test_async_step_user_no_devices_found(hass: HomeAssistant) -> None:
5454 assert result ["reason" ] == "no_devices_found"
5555
5656
57+ async def test_async_step_user_replaces_ignored (hass : HomeAssistant ) -> None :
58+ """Test setup from service info cache replaces an ignored entry."""
59+ entry = MockConfigEntry (
60+ domain = DOMAIN ,
61+ unique_id = RAPT_MAC ,
62+ data = {},
63+ source = config_entries .SOURCE_IGNORE ,
64+ )
65+ entry .add_to_hass (hass )
66+ with patch (
67+ "homeassistant.components.rapt_ble.config_flow.async_discovered_service_info" ,
68+ return_value = [COMPLETE_SERVICE_INFO ],
69+ ):
70+ result = await hass .config_entries .flow .async_init (
71+ DOMAIN ,
72+ context = {"source" : config_entries .SOURCE_USER },
73+ )
74+ assert result ["type" ] is FlowResultType .FORM
75+ assert result ["step_id" ] == "user"
76+ with patch (
77+ "homeassistant.components.rapt_ble.async_setup_entry" , return_value = True
78+ ):
79+ result2 = await hass .config_entries .flow .async_configure (
80+ result ["flow_id" ],
81+ user_input = {"address" : RAPT_MAC },
82+ )
83+ assert result2 ["type" ] is FlowResultType .CREATE_ENTRY
84+ assert result2 ["title" ] == "RAPT Pill 0666"
85+ assert result2 ["data" ] == {}
86+ assert result2 ["result" ].unique_id == RAPT_MAC
87+
88+
5789async def test_async_step_user_with_found_devices (hass : HomeAssistant ) -> None :
5890 """Test setup from service info cache with devices found."""
5991 with patch (
0 commit comments