UT: Pass event queue to MimikatzCredentialCollector's constructor in tests

This commit is contained in:
Shreya Malviya 2022-08-16 13:25:03 +05:30
parent c8a2c2156b
commit f453ff21fd
1 changed files with 4 additions and 1 deletions

View File

@ -1,8 +1,10 @@
from typing import Sequence from typing import Sequence
from unittest.mock import MagicMock
import pytest import pytest
from common.credentials import Credentials, LMHash, NTHash, Password, Username from common.credentials import Credentials, LMHash, NTHash, Password, Username
from common.event_queue import IEventQueue
from infection_monkey.credential_collectors import MimikatzCredentialCollector from infection_monkey.credential_collectors import MimikatzCredentialCollector
from infection_monkey.credential_collectors.mimikatz_collector.windows_credentials import ( from infection_monkey.credential_collectors.mimikatz_collector.windows_credentials import (
WindowsCredentials, WindowsCredentials,
@ -18,7 +20,8 @@ def patch_pypykatz(win_creds: [WindowsCredentials], monkeypatch):
def collect_credentials() -> Sequence[Credentials]: def collect_credentials() -> Sequence[Credentials]:
return MimikatzCredentialCollector().collect_credentials() mock_event_queue = MagicMock(spec=IEventQueue)
return MimikatzCredentialCollector(mock_event_queue).collect_credentials()
@pytest.mark.parametrize( @pytest.mark.parametrize(