@@ -1444,7 +1444,7 @@ def test_FileWidget__on_export_clicked(mocker, session, source):
1444
1444
1445
1445
def test_ExportDialog__export (mocker ):
1446
1446
"""
1447
- Ensure export runs preflight checks and requests password .
1447
+ Ensure happy path runs preflight checks and requests passphrase .
1448
1448
"""
1449
1449
controller = mocker .MagicMock ()
1450
1450
export_dialog = ExportDialog (controller , 'mock_uuid' )
@@ -1456,9 +1456,45 @@ def test_ExportDialog__export(mocker):
1456
1456
export_dialog ._request_passphrase .assert_called_with ()
1457
1457
1458
1458
1459
+ def test_ExportDialog__export_request_to_insert_usb_device_on_CALLED_PROCESS_ERROR (mocker ):
1460
+ """
1461
+ Ensure request to insert USB device on CALLED_PROCESS_ERROR.
1462
+ """
1463
+ controller = mocker .MagicMock ()
1464
+ called_process_error = ExportError (ExportStatus .CALLED_PROCESS_ERROR .value )
1465
+ controller .run_export_preflight_checks = mocker .MagicMock (side_effect = called_process_error )
1466
+ export_dialog = ExportDialog (controller , 'mock_uuid' )
1467
+ export_dialog ._request_passphrase = mocker .MagicMock ()
1468
+ export_dialog ._request_to_insert_usb_device = mocker .MagicMock ()
1469
+ export_dialog ._update = mocker .MagicMock ()
1470
+
1471
+ export_dialog ._export ()
1472
+
1473
+ export_dialog ._request_passphrase .assert_not_called ()
1474
+ export_dialog ._request_to_insert_usb_device .assert_called_once_with ()
1475
+ export_dialog ._update .assert_not_called ()
1476
+
1477
+
1478
+ def test_ExportDialog__export_request_to_insert_usb_device_on_USB_NOT_CONNECTED (mocker ):
1479
+ """
1480
+ Ensure request to insert USB device on USB_NOT_CONNECTED.
1481
+ """
1482
+ controller = mocker .MagicMock ()
1483
+ usb_not_connected_error = ExportError (ExportStatus .USB_NOT_CONNECTED .value )
1484
+ controller .run_export_preflight_checks = mocker .MagicMock (side_effect = usb_not_connected_error )
1485
+ export_dialog = ExportDialog (controller , 'mock_uuid' )
1486
+ export_dialog ._request_passphrase = mocker .MagicMock ()
1487
+ export_dialog ._update = mocker .MagicMock ()
1488
+
1489
+ export_dialog ._export ()
1490
+
1491
+ export_dialog ._request_passphrase .assert_not_called ()
1492
+ export_dialog ._update .assert_called_once_with ('USB_NOT_CONNECTED' )
1493
+
1494
+
1459
1495
def test_ExportDialog__export_updates_on_ExportError (mocker ):
1460
1496
"""
1461
- Ensure export runs update and does not ask for password when preflight checks error .
1497
+ Ensure update is run for ExportError that is not USB_NOT_CONNECTED or CALLED_PROCESS_ERROR .
1462
1498
"""
1463
1499
controller = mocker .MagicMock ()
1464
1500
controller .run_export_preflight_checks = mocker .MagicMock (side_effect = ExportError ('mock' ))
@@ -1472,6 +1508,74 @@ def test_ExportDialog__export_updates_on_ExportError(mocker):
1472
1508
export_dialog ._update .assert_called_once_with ('mock' )
1473
1509
1474
1510
1511
+ def test_ExportDialog__on_retry_export_button_clicked (mocker ):
1512
+ """
1513
+ Ensure happy path runs preflight checks and requests passphrase.
1514
+ """
1515
+ controller = mocker .MagicMock ()
1516
+ export_dialog = ExportDialog (controller , 'mock_uuid' )
1517
+ export_dialog ._request_passphrase = mocker .MagicMock ()
1518
+
1519
+ export_dialog ._on_retry_export_button_clicked ()
1520
+
1521
+ controller .run_export_preflight_checks .assert_called_with ()
1522
+ export_dialog ._request_passphrase .assert_called_with ()
1523
+
1524
+
1525
+ def test_ExportDialog__on_retry_export_button_clicked_USB_NOT_CONNECTED (mocker ):
1526
+ """
1527
+ Ensure request to insert USB device on USB_NOT_CONNECTED.
1528
+ """
1529
+ controller = mocker .MagicMock ()
1530
+ usb_not_connected_error = ExportError (ExportStatus .USB_NOT_CONNECTED .value )
1531
+ controller .run_export_preflight_checks = mocker .MagicMock (side_effect = usb_not_connected_error )
1532
+ export_dialog = ExportDialog (controller , 'mock_uuid' )
1533
+ export_dialog ._request_passphrase = mocker .MagicMock ()
1534
+ export_dialog ._update = mocker .MagicMock ()
1535
+
1536
+ export_dialog ._on_retry_export_button_clicked ()
1537
+
1538
+ export_dialog ._request_passphrase .assert_not_called ()
1539
+ export_dialog ._update .assert_called_once_with ('USB_NOT_CONNECTED' )
1540
+
1541
+
1542
+ def test_ExportDialog__on_retry_export_button_clicked_CALLED_PROCESS_ERROR (mocker ):
1543
+ """
1544
+ Ensure update is run on CALLED_PROCESS_ERROR.
1545
+ """
1546
+ controller = mocker .MagicMock ()
1547
+ called_process_error = ExportError (ExportStatus .CALLED_PROCESS_ERROR .value )
1548
+ controller .run_export_preflight_checks = mocker .MagicMock (side_effect = called_process_error )
1549
+ export_dialog = ExportDialog (controller , 'mock_uuid' )
1550
+ export_dialog ._request_passphrase = mocker .MagicMock ()
1551
+ export_dialog ._request_to_insert_usb_device = mocker .MagicMock ()
1552
+ export_dialog ._update = mocker .MagicMock ()
1553
+
1554
+ export_dialog ._on_retry_export_button_clicked ()
1555
+
1556
+ export_dialog ._request_passphrase .assert_not_called ()
1557
+ export_dialog ._request_to_insert_usb_device .assert_not_called ()
1558
+ export_dialog ._update .assert_called_once_with ('CALLED_PROCESS_ERROR' )
1559
+
1560
+
1561
+ def test_ExportDialog__on_retry_export_button_clicked_updates_on_ExportError (mocker ):
1562
+ """
1563
+ Ensure update is run for ExportError that is not USB_NOT_CONNECTED.
1564
+ """
1565
+ controller = mocker .MagicMock ()
1566
+ controller .run_export_preflight_checks = mocker .MagicMock (side_effect = ExportError ('mock' ))
1567
+ export_dialog = ExportDialog (controller , 'mock_uuid' )
1568
+ export_dialog ._request_passphrase = mocker .MagicMock ()
1569
+ export_dialog ._request_to_insert_usb_device = mocker .MagicMock ()
1570
+ export_dialog ._update = mocker .MagicMock ()
1571
+
1572
+ export_dialog ._on_retry_export_button_clicked ()
1573
+
1574
+ export_dialog ._request_passphrase .assert_not_called ()
1575
+ export_dialog ._request_to_insert_usb_device .assert_not_called ()
1576
+ export_dialog ._update .assert_called_once_with ('mock' )
1577
+
1578
+
1475
1579
def test_ExportDialog__request_to_insert_usb_device (mocker ):
1476
1580
"""Ensure that the correct widgets are visible or hidden."""
1477
1581
export_dialog = ExportDialog (mocker .MagicMock (), 'mock_uuid' )
0 commit comments