From c1dcb285ae889c4e9900d512f808dcf0887c3132 Mon Sep 17 00:00:00 2001 From: Kekoa Kaaikala Date: Thu, 29 Sep 2022 19:36:18 +0000 Subject: [PATCH] UT: Properly group arrange/assert/act steps --- .../cc/agent_event_handlers/test_handle_ping_scan_event.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/monkey/tests/unit_tests/monkey_island/cc/agent_event_handlers/test_handle_ping_scan_event.py b/monkey/tests/unit_tests/monkey_island/cc/agent_event_handlers/test_handle_ping_scan_event.py index cd29591a7..d0af268e1 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/agent_event_handlers/test_handle_ping_scan_event.py +++ b/monkey/tests/unit_tests/monkey_island/cc/agent_event_handlers/test_handle_ping_scan_event.py @@ -131,11 +131,11 @@ def test_handle_ping_scan_event__target_machine_not_exists( ): machine_repository.get_machine_by_id = MagicMock(side_effect=machine_from_id) machine_repository.get_machines_by_ip = MagicMock(side_effect=UnknownRecordError) + handler(EVENT) expected_machine = Machine(id=SEED_ID, network_interfaces=[IPv4Interface(EVENT.target)]) expected_machine.operating_system = EVENT.os - machine_repository.upsert_machine.assert_called_with(expected_machine) @@ -145,11 +145,11 @@ def test_handle_ping_scan_event__target_machine_already_exists( ): machine_repository.get_machine_by_id = MagicMock(side_effect=machine_from_id) machine_repository.get_machines_by_ip = MagicMock(side_effect=machines_from_ip) + handler(EVENT) expected_machine = TARGET_MACHINE.copy() expected_machine.operating_system = OperatingSystem.LINUX - machine_repository.upsert_machine.assert_called_with(expected_machine) @@ -160,6 +160,7 @@ def test_handle_ping_scan_event__upserts_node( ): machine_repository.get_machine_by_id = MagicMock(side_effect=machine_from_id) machine_repository.get_machines_by_ip = MagicMock(return_value=[TARGET_MACHINE]) + handler(EVENT) node_repository.upsert_communication.assert_called_with(