Island: Add default value for Machine.operating_system_version

This commit is contained in:
Mike Salvatore 2022-08-29 20:25:33 -04:00
parent 3e2244cd62
commit 5d51b40475
2 changed files with 10 additions and 1 deletions

View File

@ -26,7 +26,7 @@ class Machine(MutableInfectionMonkeyBaseModel):
operating_system: Optional[OperatingSystem] operating_system: Optional[OperatingSystem]
"""The operating system the machine is running""" """The operating system the machine is running"""
operating_system_version: str operating_system_version: str = Field(default="")
"""The specific version of the operating system the machine is running""" """The specific version of the operating system the machine is running"""
hostname: str hostname: str

View File

@ -180,6 +180,15 @@ def test_set_operating_system_version():
m.operating_system_version = "1234" m.operating_system_version = "1234"
def test_operating_system_version_default_value():
missing_operating_system_version_dict = MACHINE_OBJECT_DICT.copy()
del missing_operating_system_version_dict["operating_system_version"]
m = Machine(**missing_operating_system_version_dict)
assert m.operating_system_version == ""
def test_set_hostname(): def test_set_hostname():
m = Machine(**MACHINE_OBJECT_DICT) m = Machine(**MACHINE_OBJECT_DICT)