Agent: Use existing patch function in test_pypykatz_result_parsing_no_secrets

This commit is contained in:
Shreya Malviya 2022-08-17 18:03:07 +05:30
parent 4334740002
commit 6722057491
1 changed files with 2 additions and 6 deletions

View File

@ -1,5 +1,5 @@
from typing import Sequence from typing import Sequence
from unittest.mock import MagicMock, Mock from unittest.mock import MagicMock
import pytest import pytest
@ -121,11 +121,7 @@ def test_pypykatz_result_parsing_no_secrets(monkeypatch):
def test_mimikatz_credentials_stolen_event_published(monkeypatch): def test_mimikatz_credentials_stolen_event_published(monkeypatch):
mock_event_queue = MagicMock(spec=IEventQueue) mock_event_queue = MagicMock(spec=IEventQueue)
mock_pypykatz_handler = Mock() patch_pypykatz([], monkeypatch)
monkeypatch.setattr(
"infection_monkey.credential_collectors.mimikatz_collector.pypykatz_handler",
mock_pypykatz_handler,
)
mimikatz_credential_collector = MimikatzCredentialCollector(mock_event_queue) mimikatz_credential_collector = MimikatzCredentialCollector(mock_event_queue)
collected_credentials = mimikatz_credential_collector.collect_credentials() collected_credentials = mimikatz_credential_collector.collect_credentials()