forked from p15670423/monkey
Island: Add default value for Machine.hostname
This commit is contained in:
parent
5d51b40475
commit
ac1cda40a8
|
@ -29,7 +29,7 @@ class Machine(MutableInfectionMonkeyBaseModel):
|
|||
operating_system_version: str = Field(default="")
|
||||
"""The specific version of the operating system the machine is running"""
|
||||
|
||||
hostname: str
|
||||
hostname: str = Field(default="")
|
||||
"""The hostname of the machine"""
|
||||
|
||||
_make_immutable_sequence = validator("network_interfaces", pre=True, allow_reuse=True)(
|
||||
|
|
|
@ -194,3 +194,12 @@ def test_set_hostname():
|
|||
|
||||
# Raises exception_on_failure
|
||||
m.operating_system_version = "wopr"
|
||||
|
||||
|
||||
def test_hostname_default_value():
|
||||
missing_hostname_dict = MACHINE_OBJECT_DICT.copy()
|
||||
del missing_hostname_dict["hostname"]
|
||||
|
||||
m = Machine(**missing_hostname_dict)
|
||||
|
||||
assert m.hostname == ""
|
||||
|
|
Loading…
Reference in New Issue