From bde4162f4a69c87ec0fe4229d71cae82e44f17b2 Mon Sep 17 00:00:00 2001 From: "bodong.yang" Date: Fri, 8 Nov 2024 03:22:45 +0000 Subject: [PATCH] fix up test --- tests/test_otaclient/test_create_standby.py | 2 ++ tests/test_otaclient/test_ota_client.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_otaclient/test_create_standby.py b/tests/test_otaclient/test_create_standby.py index a939457f9..2d8eaf256 100644 --- a/tests/test_otaclient/test_create_standby.py +++ b/tests/test_otaclient/test_create_standby.py @@ -90,6 +90,8 @@ def test_update_with_rebuild_mode(self, mocker: MockerFixture): otaclient_control_flags = typing.cast( OTAClientControlFlags, mocker.MagicMock(spec=OTAClientControlFlags) ) + otaclient_control_flags._can_reboot = _can_reboot = mocker.MagicMock() + _can_reboot.is_set = mocker.MagicMock(return_value=True) ca_store = load_ca_cert_chains(cfg.CERTS_DIR) diff --git a/tests/test_otaclient/test_ota_client.py b/tests/test_otaclient/test_ota_client.py index 4cebecb8d..fb791b93d 100644 --- a/tests/test_otaclient/test_ota_client.py +++ b/tests/test_otaclient/test_ota_client.py @@ -176,6 +176,9 @@ def test_otaupdater(self, mocker: pytest_mock.MockerFixture): otaclient_control_flags = typing.cast( OTAClientControlFlags, mocker.MagicMock(spec=OTAClientControlFlags) ) + otaclient_control_flags._can_reboot = _can_reboot = mocker.MagicMock() + _can_reboot.is_set = mocker.MagicMock(return_value=True) + ca_store = load_ca_cert_chains(cfg.CERTS_DIR) _updater = _OTAUpdater( @@ -199,7 +202,7 @@ def test_otaupdater(self, mocker: pytest_mock.MockerFixture): _downloaded_files_size += _f.stat().st_size assert _downloaded_files_size == self._delta_bundle.total_download_files_size # assert the control_flags has been waited - otaclient_control_flags.wait_can_reboot_flag.assert_called_once() + otaclient_control_flags._can_reboot.is_set.assert_called_once() assert _updater.updating_version == str(cfg.UPDATE_VERSION) # assert boot controller is used self._boot_control.pre_update.assert_called_once()