Use stub for PBA
This commit is contained in:
parent
8bd30ceb4c
commit
2bc27b48de
|
@ -1,31 +1,24 @@
|
|||
import pytest
|
||||
|
||||
from common.data.post_breach_consts import POST_BREACH_JOB_SCHEDULING
|
||||
from infection_monkey.post_breach.actions.schedule_jobs import ScheduleJobs
|
||||
from infection_monkey.post_breach.job_scheduling.linux_job_scheduling import (
|
||||
get_linux_commands_to_schedule_jobs,
|
||||
)
|
||||
from infection_monkey.post_breach.job_scheduling.windows_job_scheduling import (
|
||||
get_windows_commands_to_schedule_jobs,
|
||||
)
|
||||
from infection_monkey.telemetry.post_breach_telem import PostBreachTelem
|
||||
from infection_monkey.utils.environment import is_windows_os
|
||||
|
||||
|
||||
HOSTNAME = "hostname"
|
||||
IP = "0.0.0.0"
|
||||
PBA = ScheduleJobs()
|
||||
PBA_COMMAND = (
|
||||
get_windows_commands_to_schedule_jobs()
|
||||
if is_windows_os()
|
||||
else " ".join(get_linux_commands_to_schedule_jobs())
|
||||
)
|
||||
PBA_NAME = POST_BREACH_JOB_SCHEDULING
|
||||
PBA_COMMAND = "run some pba"
|
||||
PBA_NAME = "some pba"
|
||||
RESULT = False
|
||||
|
||||
|
||||
class StubSomePBA:
|
||||
def __init__(self):
|
||||
self.name = PBA_NAME
|
||||
self.command = PBA_COMMAND
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def post_breach_telem_test_instance(monkeypatch):
|
||||
PBA = StubSomePBA()
|
||||
monkeypatch.setattr(PostBreachTelem, "_get_hostname_and_ip", lambda: (HOSTNAME, IP))
|
||||
return PostBreachTelem(PBA, RESULT)
|
||||
|
||||
|
|
Loading…
Reference in New Issue