From 66e8032ef343b3af8f33358436d1679cd4186941 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Thu, 29 Sep 2022 13:45:59 +0200 Subject: [PATCH] UT: Replace call_args comparison with assert_called_with in test_ping_scanner --- .../network_scanning/test_ping_scanner.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_ping_scanner.py b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_ping_scanner.py index 466fd5828..102df5dd1 100644 --- a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_ping_scanner.py +++ b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_ping_scanner.py @@ -128,7 +128,7 @@ def test_linux_ping_success(patch_subprocess_running_ping_with_ping_output, mock assert result.response_received assert result.os == OperatingSystem.LINUX assert mock_agent_event_queue.publish.call_count == 1 - assert mock_agent_event_queue.publish.call_args[0][0] == event + mock_agent_event_queue.publish.assert_called_with(event) @pytest.mark.usefixtures("set_os_linux") @@ -142,7 +142,7 @@ def test_linux_ping_no_response( assert not result.response_received assert result.os is None assert mock_agent_event_queue.publish.call_count == 1 - assert mock_agent_event_queue.publish.call_args[0][0] == event + mock_agent_event_queue.publish.assert_called_with(event) @pytest.mark.usefixtures("set_os_windows") @@ -156,7 +156,7 @@ def test_windows_ping_success( assert result.response_received assert result.os == OperatingSystem.WINDOWS assert mock_agent_event_queue.publish.call_count == 1 - assert mock_agent_event_queue.publish.call_args[0][0] == event + mock_agent_event_queue.publish.assert_called_with(event) @pytest.mark.usefixtures("set_os_windows") @@ -170,7 +170,7 @@ def test_windows_ping_no_response( assert not result.response_received assert result.os is None assert mock_agent_event_queue.publish.call_count == 1 - assert mock_agent_event_queue.publish.call_args[0][0] == event + mock_agent_event_queue.publish.assert_called_with(event) def test_malformed_ping_command_response( @@ -183,7 +183,7 @@ def test_malformed_ping_command_response( assert not result.response_received assert result.os is None assert mock_agent_event_queue.publish.call_count == 1 - assert mock_agent_event_queue.publish.call_args[0][0] == event + mock_agent_event_queue.publish.assert_called_with(event) @pytest.mark.usefixtures("patch_subprocess_running_ping_to_raise_timeout_expired") @@ -194,7 +194,7 @@ def test_timeout_expired(mock_agent_event_queue): assert not result.response_received assert result.os is None assert mock_agent_event_queue.publish.call_count == 1 - assert mock_agent_event_queue.publish.call_args[0][0] == event + mock_agent_event_queue.publish.assert_called_with(event) @pytest.fixture