From afc2021470ee78e794933412e6a0860044fe1aa1 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Wed, 27 Jul 2022 18:16:04 +0530 Subject: [PATCH] UT: Add test for PropagationConfigurationSchema maximum depth validation --- .../common/configuration/test_agent_configuration.py | 11 +++++++++++ 1 file changed, 11 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..7a93fbe96 100644 --- a/monkey/tests/unit_tests/common/configuration/test_agent_configuration.py +++ b/monkey/tests/unit_tests/common/configuration/test_agent_configuration.py @@ -225,6 +225,17 @@ def test_propagation_configuration(): assert config_dict == PROPAGATION_CONFIGURATION +@pytest.mark.parametrize("depth", [-1, 0]) +def test_propagation_configuration__invalid_maximum_depth(depth): + schema = PropagationConfigurationSchema() + + invalid_maximum_depth_configuration = PROPAGATION_CONFIGURATION.copy() + invalid_maximum_depth_configuration["maximum_depth"] = depth + + with pytest.raises(ValidationError): + schema.load(invalid_maximum_depth_configuration) + + def test_agent_configuration(): config = AgentConfiguration.from_mapping(AGENT_CONFIGURATION) config_json = AgentConfiguration.to_json(config)