forked from p15670423/monkey
Island: Add default value for Machine.network_interfaces
This commit is contained in:
parent
da8ed9e6db
commit
40601b955c
|
@ -20,7 +20,7 @@ class Machine(MutableInfectionMonkeyBaseModel):
|
||||||
hardware_id: Optional[HardwareID]
|
hardware_id: Optional[HardwareID]
|
||||||
"""An identifier generated by the agent that uniquely identifies a machine"""
|
"""An identifier generated by the agent that uniquely identifies a machine"""
|
||||||
|
|
||||||
network_interfaces: Sequence[IPv4Interface]
|
network_interfaces: Sequence[IPv4Interface] = Field(default_factory=tuple)
|
||||||
"""The machine's networking interfaces"""
|
"""The machine's networking interfaces"""
|
||||||
|
|
||||||
operating_system: Optional[OperatingSystem]
|
operating_system: Optional[OperatingSystem]
|
||||||
|
|
|
@ -141,6 +141,15 @@ def test_network_interfaces_sequence_is_immutable():
|
||||||
assert not isinstance(m.network_interfaces, MutableSequence)
|
assert not isinstance(m.network_interfaces, MutableSequence)
|
||||||
|
|
||||||
|
|
||||||
|
def test_network_interfaces_default():
|
||||||
|
missing_network_interfaces_dict = MACHINE_OBJECT_DICT.copy()
|
||||||
|
del missing_network_interfaces_dict["network_interfaces"]
|
||||||
|
|
||||||
|
m = Machine(**missing_network_interfaces_dict)
|
||||||
|
|
||||||
|
assert len(m.network_interfaces) == 0
|
||||||
|
|
||||||
|
|
||||||
def test_operating_system_set_valid_value():
|
def test_operating_system_set_valid_value():
|
||||||
m = Machine(**MACHINE_OBJECT_DICT)
|
m = Machine(**MACHINE_OBJECT_DICT)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue