From e6108d0fc77da9daef2432f7e213f7ebf65f11d2 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Wed, 27 Jul 2022 18:32:02 +0530 Subject: [PATCH] UT: Add test for AgentConfigurationSchema tunnel open time validation --- .../common/configuration/test_agent_configuration.py | 8 ++++++++ 1 file changed, 8 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 95539b9c7..0d6ffa3c6 100644 --- a/monkey/tests/unit_tests/common/configuration/test_agent_configuration.py +++ b/monkey/tests/unit_tests/common/configuration/test_agent_configuration.py @@ -239,6 +239,14 @@ def test_agent_configuration(): assert json.loads(config_json) == AGENT_CONFIGURATION +def test_agent_configuration__negative_keep_tunnel_open_time(): + negative_keep_tunnel_open_time_configuration = AGENT_CONFIGURATION.copy() + negative_keep_tunnel_open_time_configuration["keep_tunnel_open_time"] = -1 + + with pytest.raises(InvalidConfigurationError): + AgentConfiguration.from_mapping(negative_keep_tunnel_open_time_configuration) + + def test_incorrect_type(): valid_config = AgentConfiguration.from_mapping(AGENT_CONFIGURATION) with pytest.raises(InvalidConfigurationError):