UT: Add test for TCPScanConfigurationSchema port validation

This commit is contained in:
Shreya Malviya 2022-07-27 16:06:37 +05:30
parent cb97e021a7
commit 5a6173163b
1 changed files with 11 additions and 0 deletions

View File

@ -135,6 +135,17 @@ def test_tcp_scan_configuration_schema():
assert config.ports == tuple(PORTS)
@pytest.mark.parametrize("ports", [[-1, 1, 2], [1, 2, 99999]])
def test_tcp_scan_configuration_schema__ports_out_of_range(ports):
schema = TCPScanConfigurationSchema()
invalid_ports_configuration = TCP_SCAN_CONFIGURATION.copy()
invalid_ports_configuration["ports"] = ports
with pytest.raises(ValidationError):
schema.load(invalid_ports_configuration)
def test_network_scan_configuration():
schema = NetworkScanConfigurationSchema()