From aa01dfba7a327a6fa695c16b3359d6c31343523c Mon Sep 17 00:00:00 2001 From: Pierre Equoy Date: Fri, 15 Mar 2024 10:53:24 +0800 Subject: [PATCH] Add unit tests for SessionAssistant --- .../plainbox/impl/session/test_assistant.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/checkbox-ng/plainbox/impl/session/test_assistant.py b/checkbox-ng/plainbox/impl/session/test_assistant.py index 165d4b58a..b0400cf32 100644 --- a/checkbox-ng/plainbox/impl/session/test_assistant.py +++ b/checkbox-ng/plainbox/impl/session/test_assistant.py @@ -203,3 +203,27 @@ def test_bootstrap(self, mock_tpu, mock_su, mock_get_providers): self_mock._context.state.update_desired_job_list.call_count, 2 ) + + @mock.patch("plainbox.impl.session.state.select_units") + def test_hand_pick_jobs(self, mock_su, mock_get_providers): + self_mock = mock.MagicMock() + SessionAssistant.hand_pick_jobs(self_mock, []) + self.assertEqual( + self_mock._context.state.update_desired_job_list.call_count, + 1 + ) + + @mock.patch("plainbox.impl.session.state.select_units") + @mock.patch("plainbox.impl.unit.testplan.TestPlanUnit") + def test_get_bootstrap_todo_list( + self, + mock_tpu, + mock_su, + mock_get_providers + ): + self_mock = mock.MagicMock() + SessionAssistant.get_bootstrap_todo_list(self_mock) + self.assertEqual( + self_mock._context.state.update_desired_job_list.call_count, + 1 + )