From 1afafd20dd20da85e10f4c24319d6ab3c1eb6e28 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Wed, 21 Sep 2022 18:09:13 +0530 Subject: [PATCH] UT: Simplify some logic in test_island_mode.py's flask_client fixture --- .../monkey_island/cc/resources/test_island_mode.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/monkey/tests/unit_tests/monkey_island/cc/resources/test_island_mode.py b/monkey/tests/unit_tests/monkey_island/cc/resources/test_island_mode.py index 1386bb6c7..0b9403362 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/resources/test_island_mode.py +++ b/monkey/tests/unit_tests/monkey_island/cc/resources/test_island_mode.py @@ -18,12 +18,10 @@ def flask_client(build_flask_client): in_memory_simulation_repository = InMemorySimulationRepository() container.register_instance(ISimulationRepository, in_memory_simulation_repository) - def wrap_in_memory_simulation_repository_set_mode(topic, event): - mode = event - in_memory_simulation_repository.set_mode(mode) - mock_island_event_queue = MagicMock(spec=IIslandEventQueue) - mock_island_event_queue.publish.side_effect = wrap_in_memory_simulation_repository_set_mode + mock_island_event_queue.publish.side_effect = ( + lambda topic, mode: in_memory_simulation_repository.set_mode(mode) + ) container.register_instance(IIslandEventQueue, mock_island_event_queue) with build_flask_client(container) as flask_client: