forked from p15670423/monkey
Island: Allow Agent.parent_id to be None
This commit is contained in:
parent
22701fc0a3
commit
1eefbdb2b1
|
@ -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="")
|
||||||
|
|
|
@ -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 == ""
|
||||||
|
|
Loading…
Reference in New Issue