@@ -585,8 +585,8 @@ async def test_abort_hassio_discovery_with_existing_flow(hass: HomeAssistant) ->
585
585
context = {"source" : config_entries .SOURCE_USB },
586
586
data = USB_DISCOVERY_INFO ,
587
587
)
588
- assert result ["type" ] is FlowResultType .FORM
589
- assert result ["step_id" ] == "usb_confirm "
588
+ assert result ["type" ] is FlowResultType .MENU
589
+ assert result ["step_id" ] == "installation_type "
590
590
591
591
result2 = await hass .config_entries .flow .async_init (
592
592
DOMAIN ,
@@ -664,13 +664,8 @@ async def test_usb_discovery(
664
664
context = {"source" : config_entries .SOURCE_USB },
665
665
data = usb_discovery_info ,
666
666
)
667
- assert result ["type" ] is FlowResultType .FORM
668
- assert result ["step_id" ] == "usb_confirm"
669
- assert result ["description_placeholders" ] == {"name" : discovery_name }
670
- assert mock_usb_serial_by_id .call_count == 1
671
-
672
- result = await hass .config_entries .flow .async_configure (result ["flow_id" ], {})
673
667
668
+ assert mock_usb_serial_by_id .call_count == 1
674
669
assert result ["type" ] is FlowResultType .MENU
675
670
assert result ["step_id" ] == "installation_type"
676
671
assert result ["menu_options" ] == ["intent_recommended" , "intent_custom" ]
@@ -771,12 +766,8 @@ async def test_usb_discovery_addon_not_running(
771
766
context = {"source" : config_entries .SOURCE_USB },
772
767
data = USB_DISCOVERY_INFO ,
773
768
)
774
- assert result ["type" ] is FlowResultType .FORM
775
- assert result ["step_id" ] == "usb_confirm"
776
- assert mock_usb_serial_by_id .call_count == 2
777
-
778
- result = await hass .config_entries .flow .async_configure (result ["flow_id" ], {})
779
769
770
+ assert mock_usb_serial_by_id .call_count == 2
780
771
assert result ["type" ] is FlowResultType .MENU
781
772
assert result ["step_id" ] == "installation_type"
782
773
@@ -932,12 +923,8 @@ async def mock_restore_nvm(data: bytes):
932
923
context = {"source" : config_entries .SOURCE_USB },
933
924
data = USB_DISCOVERY_INFO ,
934
925
)
935
- assert result ["type" ] is FlowResultType .FORM
936
- assert result ["step_id" ] == "usb_confirm"
937
- assert mock_usb_serial_by_id .call_count == 2
938
-
939
- result = await hass .config_entries .flow .async_configure (result ["flow_id" ], {})
940
926
927
+ assert mock_usb_serial_by_id .call_count == 2
941
928
assert result ["type" ] is FlowResultType .FORM
942
929
assert result ["step_id" ] == "intent_migrate"
943
930
@@ -1063,12 +1050,8 @@ async def mock_restore_nvm(data: bytes):
1063
1050
context = {"source" : config_entries .SOURCE_USB },
1064
1051
data = USB_DISCOVERY_INFO ,
1065
1052
)
1066
- assert result ["type" ] is FlowResultType .FORM
1067
-
8000
span> assert result ["step_id" ] == "usb_confirm"
1068
- assert mock_usb_serial_by_id .call_count == 2
1069
-
1070
- result = await hass .config_entries .flow .async_configure (result ["flow_id" ], {})
1071
1053
1054
+ assert mock_usb_serial_by_id .call_count == 2
1072
1055
assert result ["type" ] is FlowResultType .FORM
1073
1056
assert result ["step_id" ] == "intent_migrate"
1074
1057
@@ -1366,16 +1349,16 @@ async def test_usb_discovery_with_existing_usb_flow(hass: HomeAssistant) -> None
1366
1349
data = first_usb_info ,
1367
1350
)
1368
1351
1369
- assert result ["type" ] is FlowResultType .FORM
1370
- assert result ["step_id" ] == "usb_confirm "
1352
+ assert result ["type" ] is FlowResultType .MENU
1353
+ assert result ["step_id" ] == "installation_type "
1371
1354
1372
1355
result2 = await hass .config_entries .flow .async_init (
1373
1356
DOMAIN ,
1374
1357
context = {"source" : config_entries .SOURCE_USB },
1375
1358
data = USB_DISCOVERY_INFO ,
1376
1359
)
1377
- assert result2 ["type" ] is FlowResultType .FORM
1378
- assert result2 ["step_id" ] == "usb_confirm "
1360
+ assert result2 ["type" ] is FlowResultType .MENU
1361
+ assert result2 ["step_id" ] == "installation_type "
1379
1362
1380
1363
usb_flows_in_progress = hass .config_entries .flow .async_progress_by_handler (
1381
1364
DOMAIN , match_context = {"source" : config_entries .SOURCE_USB }
@@ -1409,53 +1392,6 @@ async def test_abort_usb_discovery_addon_required(hass: HomeAssistant) -> None:
1409
1392
assert result ["reason" ] == "addon_required"
1410
1393
1411
1394
1412
- @pytest .mark .usefixtures (
1413
- "supervisor" ,
1414
- "addon_running" ,
1415
- )
1416
- async def test_abort_usb_discovery_confirm_addon_required (
1417
- hass : HomeAssistant ,
1418
- addon_options : dict [str , Any ],
1419
- mock_usb_serial_by_id : MagicMock ,
1420
- ) -> None :
1421
- """Test usb discovery confirm aborted when existing entry not using add-on."""
1422
- addon_options ["device" ] = "/dev/another_device"
1423
- entry = MockConfigEntry (
1424
- domain = DOMAIN ,
1425
- data = {
1426
- "url" : "ws://localhost:3000" ,
1427
- "usb_path" : "/dev/another_device" ,
1428
- "use_addon" : True ,
1429
- },
1430
- title = TITLE ,
1431
- unique_id = "1234" ,
1432
- )
1433
- entry .add_to_hass (hass )
1434
-
1435
- result = await hass .config_entries .flow .async_init (
1436
- DOMAIN ,
1437
- context = {"source" : config_entries .SOURCE_USB },
1438
- data = USB_DISCOVERY_INFO ,
1439
- )
1440
-
1441
- assert result ["type" ] is FlowResultType .FORM
1442
- assert result ["step_id" ] == "usb_confirm"
1443
- assert mock_usb_serial_by_id .call_count == 2
1444
-
1445
- hass .config_entries .async_update_entry (
1446
- entry ,
1447
- data = {
1448
- ** entry .data ,
1449
- "use_addon" : False ,
1450
- },
1451
- )
1452
-
1453
- result = await hass .config_entries .flow .async_configure (result ["flow_id" ], {})
1454
-
1455
- assert result ["type" ] is FlowResultType .ABORT
1456
- assert result ["reason" ] == "addon_required"
1457
-
1458
-
1459
1395
async def test_usb_discovery_requires_supervisor (hass : HomeAssistant ) -> None :
1460
1396
"""Test usb discovery flow is aborted when there is no supervisor."""
1461
1397
result = await hass .config_entries .flow .async_init (
@@ -4635,13 +4571,8 @@ async def test_recommended_usb_discovery(
4635
4571
context = {"source" : config_entries .SOURCE_USB },
4636
4572
data = usb_discovery_info ,
4637
4573
)
4638
- assert result ["type" ] is FlowResultType .FORM
4639
- assert result ["step_id" ] == "usb_confirm"
4640
- assert result ["description_placeholders" ] == {"name" : discovery_name }
4641
- assert mock_usb_serial_by_id .call_count == 1
4642
-
4643
- result = await hass .config_entries .flow .async_configure (result ["flow_id" ], {})
4644
4574
4575
+ assert mock_usb_serial_by_id .call_count == 1
4645
4576
assert result ["type" ] is FlowResultType .MENU
4646
4577
assert result ["step_id" ] == "installation_type"
4647
4578
assert result ["menu_options" ] == ["intent_recommended" , "intent_custom" ]
0 commit comments