forked from p15670423/monkey
tests: Move telemetry_messenger_spy to infection_monkey/conftest.py
This commit is contained in:
parent
e549a4f8f4
commit
691e01e9c1
|
@ -0,0 +1,17 @@
|
|||
import pytest
|
||||
|
||||
from infection_monkey.telemetry.i_telem import ITelem
|
||||
from infection_monkey.telemetry.messengers.i_telemetry_messenger import ITelemetryMessenger
|
||||
|
||||
|
||||
class TelemetryMessengerSpy(ITelemetryMessenger):
|
||||
def __init__(self):
|
||||
self.telemetries = []
|
||||
|
||||
def send_telemetry(self, telemetry: ITelem):
|
||||
self.telemetries.append(telemetry)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def telemetry_messenger_spy():
|
||||
return TelemetryMessengerSpy()
|
|
@ -23,16 +23,6 @@ from tests.utils import hash_file, is_user_admin
|
|||
|
||||
from infection_monkey.ransomware import ransomware_payload as ransomware_payload_module
|
||||
from infection_monkey.ransomware.ransomware_payload import EXTENSION, RansomewarePayload
|
||||
from infection_monkey.telemetry.i_telem import ITelem
|
||||
from infection_monkey.telemetry.messengers.i_telemetry_messenger import ITelemetryMessenger
|
||||
|
||||
|
||||
class TelemetryMessengerSpy(ITelemetryMessenger):
|
||||
def __init__(self):
|
||||
self.telemetries = []
|
||||
|
||||
def send_telemetry(self, telemetry: ITelem):
|
||||
self.telemetries.append(telemetry)
|
||||
|
||||
|
||||
def with_extension(filename):
|
||||
|
@ -46,11 +36,6 @@ def ransomware_payload_config(ransomware_target):
|
|||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def telemetry_messenger_spy():
|
||||
return TelemetryMessengerSpy()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def ransomware_payload(ransomware_payload_config, telemetry_messenger_spy):
|
||||
return RansomewarePayload(ransomware_payload_config, telemetry_messenger_spy)
|
||||
|
|
Loading…
Reference in New Issue