From 65ce50cac15171a353dcb1d35c7a4538a173412c Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Wed, 27 Jul 2022 16:51:17 +0530 Subject: [PATCH] UT: Add test for ICMPScanConfigurationSchema timeout validation --- .../common/configuration/test_agent_configuration.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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..f1dfa43a0 100644 --- a/monkey/tests/unit_tests/common/configuration/test_agent_configuration.py +++ b/monkey/tests/unit_tests/common/configuration/test_agent_configuration.py @@ -126,6 +126,16 @@ def test_icmp_scan_configuration_schema(): assert config.timeout == TIMEOUT +def test_icmp_scan_configuration_schema__negative_timeout(): + schema = ICMPScanConfigurationSchema() + + negative_timeout_configuration = ICMP_CONFIGURATION.copy() + negative_timeout_configuration["timeout"] = -1 + + with pytest.raises(ValidationError): + schema.load(negative_timeout_configuration) + + def test_tcp_scan_configuration_schema(): schema = TCPScanConfigurationSchema()