-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
As suggested in PR #1 by @sourcery-ai[bot]:
scan_host is not tested for the case where ping_host returns False (host is offline).
Task: Add a test for when ping_host returns False to verify scan_host handles offline hosts correctly.
Expected behavior:
- 'alive' should be False
- 'open_ports' should be empty list
- 'services' should be empty dict
Example test:
def test_scan_host_offline(self):
"""Test scan_host with offline host."""
with patch('src.lancompute.network_scanner.ping_host', return_value=False):
result = scan_host("192.168.1.100", [80, 8080])
assert result['ip'] == "192.168.1.100"
assert result['alive'] is False
assert result['open_ports'] == []
assert result['services'] == {}File: tests/test_network_scanner.py
Metadata
Metadata
Assignees
Labels
No labels