diff --git a/tests/unit_tests/test_espota2.py b/tests/unit_tests/test_espota2.py index 42d133ca9b..2d65e8e079 100644 --- a/tests/unit_tests/test_espota2.py +++ b/tests/unit_tests/test_espota2.py @@ -416,6 +416,9 @@ def test_perform_ota_no_auth( "Update took 14.00 seconds (prepare 2.00, upload 5.00, commit 7.00)" in caplog.text ) + # The data phase timeout must outlast the device's 105 s data timeout + mock_socket.settimeout.assert_any_call(espota2.DATA_PHASE_TIMEOUT) + assert espota2.DATA_PHASE_TIMEOUT > 105.0 @pytest.mark.usefixtures("mock_time") @@ -754,12 +757,8 @@ def test_run_ota_impl_successful( assert result_code == 0 assert result_host == "192.168.1.100" - # Verify socket was configured correctly: connect timeout first, then the - # data phase timeout, which must outlast the device's 105 s data timeout - timeouts = [c.args[0] for c in mock_socket.settimeout.call_args_list] - assert timeouts[0] == 20.0 - assert espota2.DATA_PHASE_TIMEOUT in timeouts - assert espota2.DATA_PHASE_TIMEOUT > 105.0 + # Verify socket was configured correctly + mock_socket.settimeout.assert_called_with(20.0) mock_socket.connect.assert_called_once_with(("192.168.1.100", 3232)) mock_socket.close.assert_called_once()