diff --git a/monkey/common/agent_configuration/agent_sub_configurations.py b/monkey/common/agent_configuration/agent_sub_configurations.py index e358c91a9..8c4592d92 100644 --- a/monkey/common/agent_configuration/agent_sub_configurations.py +++ b/monkey/common/agent_configuration/agent_sub_configurations.py @@ -1,6 +1,6 @@ from typing import Dict, Tuple -from pydantic import PositiveFloat, PositiveInt, conint, validator +from pydantic import PositiveFloat, conint, validator from common.base_models import MutableInfectionMonkeyBaseModel @@ -185,6 +185,6 @@ class PropagationConfiguration(MutableInfectionMonkeyBaseModel): :param exploitation: Configuration for exploitation """ - maximum_depth: PositiveInt + maximum_depth: conint(ge=0) network_scan: NetworkScanConfiguration exploitation: ExploitationConfiguration diff --git a/monkey/tests/unit_tests/common/agent_configuration/test_agent_configuration.py b/monkey/tests/unit_tests/common/agent_configuration/test_agent_configuration.py index 0cd17fccc..3431b980d 100644 --- a/monkey/tests/unit_tests/common/agent_configuration/test_agent_configuration.py +++ b/monkey/tests/unit_tests/common/agent_configuration/test_agent_configuration.py @@ -229,6 +229,15 @@ def test_propagation_configuration__invalid_maximum_depth(): PropagationConfiguration(**negative_maximum_depth_configuration) +def test_propagation_configuration__maximum_depth_zero(): + maximum_depth_zero_configuration = PROPAGATION_CONFIGURATION.copy() + maximum_depth_zero_configuration["maximum_depth"] = 0 + + pc = PropagationConfiguration(**maximum_depth_zero_configuration) + + assert pc.maximum_depth == 0 + + def test_agent_configuration(): config = AgentConfiguration(**AGENT_CONFIGURATION) config_dict = config.dict(simplify=True)