Common: Allow 0 for keep_tunnel_open_time

This commit is contained in:
Mike Salvatore 2022-08-31 08:55:56 -04:00 committed by Shreya Malviya
parent 326d128be8
commit 0f21ad2e09
2 changed files with 12 additions and 3 deletions

View File

@ -1,6 +1,6 @@
from typing import Tuple
from pydantic import PositiveFloat
from pydantic import confloat
from common.base_models import MutableInfectionMonkeyBaseModel
@ -12,7 +12,7 @@ from .agent_sub_configurations import (
class AgentConfiguration(MutableInfectionMonkeyBaseModel):
keep_tunnel_open_time: PositiveFloat
keep_tunnel_open_time: confloat(ge=0)
custom_pbas: CustomPBAConfiguration
post_breach_actions: Tuple[PluginConfiguration, ...]
credential_collectors: Tuple[PluginConfiguration, ...]

View File

@ -252,7 +252,16 @@ def test_agent_configuration():
assert config_dict == AGENT_CONFIGURATION
def test_agent_configuration__negative_keep_tunnel_open_time():
def test_agent_configuration__negative_keep_tunnel_open_time_zero():
keep_tunnel_open_time_zero_configuration = AGENT_CONFIGURATION.copy()
keep_tunnel_open_time_zero_configuration["keep_tunnel_open_time"] = 0
ac = AgentConfiguration(**keep_tunnel_open_time_zero_configuration)
assert ac.keep_tunnel_open_time == 0
def test_agent_configuration__keep_tunnel_open_time():
negative_keep_tunnel_open_time_configuration = AGENT_CONFIGURATION.copy()
negative_keep_tunnel_open_time_configuration["keep_tunnel_open_time"] = -1