forked from p15670423/monkey
Island: Make Machine.operating_system Optional
This commit is contained in:
parent
ebcfe5a9fc
commit
694cdca883
|
@ -23,7 +23,7 @@ class Machine(MutableInfectionMonkeyBaseModel):
|
||||||
network_interfaces: Sequence[IPv4Interface]
|
network_interfaces: Sequence[IPv4Interface]
|
||||||
"""The machine's networking interfaces"""
|
"""The machine's networking interfaces"""
|
||||||
|
|
||||||
operating_system: 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
|
||||||
|
|
|
@ -84,6 +84,15 @@ def test_construct_invalid_field__value_error(key, value):
|
||||||
Machine(**invalid_type_dict)
|
Machine(**invalid_type_dict)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("field", ["hardware_id", "operating_system"])
|
||||||
|
def test_optional_fields(field):
|
||||||
|
none_field_dict = MACHINE_SIMPLE_DICT.copy()
|
||||||
|
none_field_dict[field] = None
|
||||||
|
|
||||||
|
# Raises exception_on_failure
|
||||||
|
Machine(**none_field_dict)
|
||||||
|
|
||||||
|
|
||||||
def test_construct__extra_fields_forbidden():
|
def test_construct__extra_fields_forbidden():
|
||||||
extra_field_dict = MACHINE_SIMPLE_DICT.copy()
|
extra_field_dict = MACHINE_SIMPLE_DICT.copy()
|
||||||
extra_field_dict["extra_field"] = 99 # red balloons
|
extra_field_dict["extra_field"] = 99 # red balloons
|
||||||
|
|
Loading…
Reference in New Issue