From 99b8321271a84a16f55963ffea1a96c9f81ccb85 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 23 Mar 2022 14:32:08 -0400 Subject: [PATCH] Tests: Fix broken PowerShellExploiter tests --- .../unit_tests/infection_monkey/exploit/test_powershell.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/monkey/tests/unit_tests/infection_monkey/exploit/test_powershell.py b/monkey/tests/unit_tests/infection_monkey/exploit/test_powershell.py index 21a0bdeb3..c88ce99d7 100644 --- a/monkey/tests/unit_tests/infection_monkey/exploit/test_powershell.py +++ b/monkey/tests/unit_tests/infection_monkey/exploit/test_powershell.py @@ -26,6 +26,9 @@ class AuthenticationErrorForTests(Exception): mock_agent_repository = MagicMock() mock_agent_repository.get_agent_binary.return_value = BytesIO(b"BINARY_EXECUTABLE") +victim_host = VictimHost("127.0.0.1") +victim_host.os["type"] = "windows" + @pytest.fixture def powershell_arguments(): @@ -39,7 +42,7 @@ def powershell_arguments(): }, } arguments = { - "host": VictimHost("127.0.0.1"), + "host": victim_host, "options": options, "current_depth": 2, "telemetry_messenger": MagicMock(), @@ -141,7 +144,7 @@ def test_successful_copy(monkeypatch, powershell_exploiter, powershell_arguments exploit_result = powershell_exploiter.exploit_host(**powershell_arguments) - assert DROPPER_TARGET_PATH_64 in mock_client.return_value.copy_file.call_args[0][1] + assert DROPPER_TARGET_PATH_64 in str(mock_client.return_value.copy_file.call_args[0][1]) assert exploit_result.exploitation_success