feat: initial release
This commit is contained in:
26
tests/test_cli.py
Normal file
26
tests/test_cli.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""Tests for CLI argument parsing."""
|
||||
|
||||
import pytest
|
||||
|
||||
from sslysze_scan.cli import parse_host_ports
|
||||
|
||||
|
||||
class TestParseHostPorts:
|
||||
"""Tests for parse_host_ports function."""
|
||||
|
||||
def test_parse_host_ports_multiple_ports(self) -> None:
|
||||
"""Test parsing hostname with multiple ports."""
|
||||
hostname, ports = parse_host_ports("example.com:443,636,993")
|
||||
assert hostname == "example.com"
|
||||
assert ports == [443, 636, 993]
|
||||
|
||||
def test_parse_host_ports_ipv6_multiple(self) -> None:
|
||||
"""Test parsing IPv6 address with multiple ports."""
|
||||
hostname, ports = parse_host_ports("[2001:db8::1]:443,636")
|
||||
assert hostname == "2001:db8::1"
|
||||
assert ports == [443, 636]
|
||||
|
||||
def test_parse_host_ports_invalid_port_range(self) -> None:
|
||||
"""Test error when port number out of range."""
|
||||
with pytest.raises(ValueError, match="Invalid port number.*Must be between"):
|
||||
parse_host_ports("example.com:99999")
|
||||
Reference in New Issue
Block a user