-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
As suggested in PR #1 by @sourcery-ai[bot]:
No test exists for scan_port returning False on socket exceptions.
Task: Add a test that simulates a socket exception (e.g., connect_ex or recv raising) and verifies that scan_port returns False.
Example test:
def test_scan_port_socket_exception(self):
"""Test that scan_port returns False on socket exceptions."""
with patch('socket.socket') as mock_socket:
mock_socket.side_effect = Exception("Socket error")
result = scan_port("127.0.0.1", 80)
assert result is FalseFile: tests/test_network_scanner.py
Metadata
Metadata
Assignees
Labels
No labels