diff --git a/monkey/monkey_island/cc/models/agent.py b/monkey/monkey_island/cc/models/agent.py index a185e4339..c2833885a 100644 --- a/monkey/monkey_island/cc/models/agent.py +++ b/monkey/monkey_island/cc/models/agent.py @@ -17,6 +17,6 @@ class Agent(MutableInfectionMonkeyBaseModel): machine_id: MachineID = Field(..., allow_mutation=False) start_time: datetime = Field(..., allow_mutation=False) stop_time: Optional[datetime] - parent_id: AgentID = Field(..., allow_mutation=False) + parent_id: Optional[AgentID] = Field(allow_mutation=False) cc_server: str = Field(default="") log_contents: str = Field(default="") diff --git a/monkey/tests/unit_tests/monkey_island/cc/models/test_agent.py b/monkey/tests/unit_tests/monkey_island/cc/models/test_agent.py index 1851a4873..fb528fd51 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/models/test_agent.py +++ b/monkey/tests/unit_tests/monkey_island/cc/models/test_agent.py @@ -31,8 +31,11 @@ def test_constructor__defaults_from_objects(): def test_constructor__defaults_from_simple_dict(): - a = Agent(**AGENT_SIMPLE_DICT) + agent_simple_dict = AGENT_SIMPLE_DICT.copy() + del agent_simple_dict["parent_id"] + a = Agent(**agent_simple_dict) + assert a.parent_id is None assert a.stop_time is None assert a.cc_server == "" assert a.log_contents == ""