diff --git a/monkey/tests/unit_tests/common/configuration/test_agent_configuration.py b/monkey/tests/unit_tests/common/configuration/test_agent_configuration.py index d7e4bebd4..3eb90b525 100644 --- a/monkey/tests/unit_tests/common/configuration/test_agent_configuration.py +++ b/monkey/tests/unit_tests/common/configuration/test_agent_configuration.py @@ -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()