From 2135bdcd103e367f2b535d0f095ba707bbebe488 Mon Sep 17 00:00:00 2001 From: Marek Wolan Date: Thu, 21 Dec 2023 16:08:09 +0000 Subject: [PATCH] Add unit test --- src/primaite/simulator/sim_container.py | 1 - .../_system/_services/test_service_actions.py | 13 +++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/primaite/simulator/sim_container.py b/src/primaite/simulator/sim_container.py index db8a718c..896861e6 100644 --- a/src/primaite/simulator/sim_container.py +++ b/src/primaite/simulator/sim_container.py @@ -60,4 +60,3 @@ class Simulation(SimComponent): """Apply a timestep to the simulation.""" super().apply_timestep(timestep) self.network.apply_timestep(timestep) - # self.domain.apply_timestep(timestep) diff --git a/tests/unit_tests/_primaite/_simulator/_system/_services/test_service_actions.py b/tests/unit_tests/_primaite/_simulator/_system/_services/test_service_actions.py index 6b2ee0a7..714644e4 100644 --- a/tests/unit_tests/_primaite/_simulator/_system/_services/test_service_actions.py +++ b/tests/unit_tests/_primaite/_simulator/_system/_services/test_service_actions.py @@ -78,3 +78,16 @@ def test_service_enable(service): service.apply_request(["enable"]) assert service.operating_state == ServiceOperatingState.STOPPED + + +def test_service_patch(service): + """Test that a service can be patched and that it takes two timesteps to complete.""" + service.start() + assert service.health_state_actual == SoftwareHealthState.GOOD + + service.apply_request(["patch"]) + assert service.health_state_actual == SoftwareHealthState.PATCHING + service.apply_timestep(1) + assert service.health_state_actual == SoftwareHealthState.PATCHING + service.apply_timestep(2) + assert service.health_state_actual == SoftwareHealthState.GOOD