tests: Move telemetry_messenger_spy to infection_monkey/conftest.py

This commit is contained in:
Mike Salvatore 2021-06-27 19:35:27 -04:00
parent e549a4f8f4
commit 691e01e9c1
2 changed files with 17 additions and 15 deletions

View File

@ -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()

View File

@ -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)