From 9a261296e4a5259aa88bff7d30c7de6fe1bd496a Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Wed, 5 Oct 2022 16:53:04 +0200 Subject: [PATCH] UT: Fix zerologon unit tests --- .../unit_tests/infection_monkey/exploit/test_zerologon.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/monkey/tests/unit_tests/infection_monkey/exploit/test_zerologon.py b/monkey/tests/unit_tests/infection_monkey/exploit/test_zerologon.py index 4a6fbf53d..d3854d57c 100644 --- a/monkey/tests/unit_tests/infection_monkey/exploit/test_zerologon.py +++ b/monkey/tests/unit_tests/infection_monkey/exploit/test_zerologon.py @@ -1,5 +1,10 @@ +from unittest.mock import MagicMock + import pytest +from common.event_queue import IAgentEventQueue +from infection_monkey.model import VictimHost + DOMAIN_NAME = "domain-name" IP = "0.0.0.0" NETBIOS_NAME = "NetBIOS Name" @@ -20,6 +25,8 @@ def zerologon_exploiter_object(monkeypatch): obj = ZerologonExploiter() monkeypatch.setattr(obj, "dc_name", NETBIOS_NAME, raising=False) monkeypatch.setattr(obj, "report_login_attempt", mock_report_login_attempt) + monkeypatch.setattr(obj, "host", VictimHost(ip_addr="1.1.1.1")) + monkeypatch.setattr(obj, "agent_event_queue", MagicMock(spec=IAgentEventQueue)) return obj