diff --git a/monkey/monkey_island/cc/models/machine.py b/monkey/monkey_island/cc/models/machine.py index b09e8bf99..31c5d41ad 100644 --- a/monkey/monkey_island/cc/models/machine.py +++ b/monkey/monkey_island/cc/models/machine.py @@ -26,7 +26,7 @@ class Machine(MutableInfectionMonkeyBaseModel): operating_system: Optional[OperatingSystem] """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""" hostname: str diff --git a/monkey/tests/unit_tests/monkey_island/cc/models/test_machine.py b/monkey/tests/unit_tests/monkey_island/cc/models/test_machine.py index a81f1823f..e60069ed6 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/models/test_machine.py +++ b/monkey/tests/unit_tests/monkey_island/cc/models/test_machine.py @@ -180,6 +180,15 @@ def test_set_operating_system_version(): 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(): m = Machine(**MACHINE_OBJECT_DICT)