Island: Allow Agent.parent_id to be None

This commit is contained in:
Mike Salvatore 2022-08-30 06:56:13 -04:00
parent 22701fc0a3
commit 1eefbdb2b1
2 changed files with 5 additions and 2 deletions

View File

@ -17,6 +17,6 @@ class Agent(MutableInfectionMonkeyBaseModel):
machine_id: MachineID = Field(..., allow_mutation=False) machine_id: MachineID = Field(..., allow_mutation=False)
start_time: datetime = Field(..., allow_mutation=False) start_time: datetime = Field(..., allow_mutation=False)
stop_time: Optional[datetime] stop_time: Optional[datetime]
parent_id: AgentID = Field(..., allow_mutation=False) parent_id: Optional[AgentID] = Field(allow_mutation=False)
cc_server: str = Field(default="") cc_server: str = Field(default="")
log_contents: str = Field(default="") log_contents: str = Field(default="")

View File

@ -31,8 +31,11 @@ def test_constructor__defaults_from_objects():
def test_constructor__defaults_from_simple_dict(): 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.stop_time is None
assert a.cc_server == "" assert a.cc_server == ""
assert a.log_contents == "" assert a.log_contents == ""