#1961: os scan set up
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import pytest
|
||||
|
||||
from primaite.simulator.network.hardware.base import Node, NodeOperatingState
|
||||
from primaite.simulator.system.processes.process import Process
|
||||
from primaite.simulator.system.services.service import Service
|
||||
from primaite.simulator.system.software import SoftwareHealthState
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -39,3 +42,31 @@ def test_node_shutdown(node):
|
||||
idx += 1
|
||||
|
||||
assert node.operating_state == NodeOperatingState.OFF
|
||||
|
||||
|
||||
def test_node_os_scan(node):
|
||||
"""Test OS Scanning."""
|
||||
# add process to node
|
||||
node.processes["process"] = Process(name="process")
|
||||
node.processes["process"].health_state_actual = SoftwareHealthState.COMPROMISED
|
||||
assert node.processes["process"].health_state_visible == SoftwareHealthState.GOOD
|
||||
|
||||
# add services to node
|
||||
service = Service(name="service")
|
||||
service.health_state_actual = SoftwareHealthState.COMPROMISED
|
||||
node.install_service(service=service)
|
||||
|
||||
# add application to node
|
||||
|
||||
# add file to node
|
||||
|
||||
# run os scan
|
||||
node.apply_request(["os", "scan"])
|
||||
|
||||
# apply time steps
|
||||
for i in range(20):
|
||||
node.apply_timestep(timestep=i)
|
||||
|
||||
# should update the state of all items
|
||||
assert node.processes["process"].health_state_visible == SoftwareHealthState.COMPROMISED
|
||||
assert service.health_state_visible == SoftwareHealthState.COMPROMISED
|
||||
|
||||
Reference in New Issue
Block a user