forked from p15670423/monkey
UT: Implement test_handle_scan_data__upserts_node
This commit is contained in:
parent
ab32daa0e0
commit
ce8219aa6d
|
@ -81,13 +81,24 @@ def test_handle_scan_data__upserts_machine(
|
||||||
expected_machine.operating_system = OperatingSystem.LINUX
|
expected_machine.operating_system = OperatingSystem.LINUX
|
||||||
|
|
||||||
assert machine_repository.upsert_machine.called_with(expected_machine)
|
assert machine_repository.upsert_machine.called_with(expected_machine)
|
||||||
assert node_repository.upsert_communication.called_with(
|
|
||||||
MACHINE.id, expected_machine.id, CommunicationType.SCANNED
|
|
||||||
|
def test_handle_scan_data__upserts_node(
|
||||||
|
handler: handle_scan_data,
|
||||||
|
machine_repository: IMachineRepository,
|
||||||
|
node_repository: INodeRepository,
|
||||||
|
):
|
||||||
|
event = PingScanEvent(
|
||||||
|
source=AGENT_ID,
|
||||||
|
target=IPv4Address("10.10.10.1"),
|
||||||
|
scan_data=PingScanData(True, OperatingSystem.LINUX),
|
||||||
)
|
)
|
||||||
|
machine_repository.get_machine_by_id = MagicMock(return_value=STORED_MACHINE)
|
||||||
|
handler(event)
|
||||||
|
|
||||||
|
assert node_repository.upsert_communication.called_with(
|
||||||
def test_handle_scan_data__upserts_node(handler: handle_scan_data):
|
MACHINE.id, STORED_MACHINE.id, CommunicationType.SCANNED
|
||||||
pass
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_handle_scan_data__node_not_upserted_if_no_matching_agent(handler: handle_scan_data):
|
def test_handle_scan_data__node_not_upserted_if_no_matching_agent(handler: handle_scan_data):
|
||||||
|
|
Loading…
Reference in New Issue