forked from p15670423/monkey
Common: Allow 0 for keep_tunnel_open_time
This commit is contained in:
parent
326d128be8
commit
0f21ad2e09
|
@ -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, ...]
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue