def test_parse_host_specs(bad_input): with pytest.raises(SpecValidationError): hs = HostSpec.from_json(bad_input)
def json_to_generic_spec(spec: dict) -> GenericSpec: if 'service_type' in spec and spec['service_type'] == 'host': return HostSpec.from_json(spec) else: return ServiceSpec.from_json(spec)
def test_parse_host_specs(test_input, expected): hs = HostSpec.from_json(test_input) assert hs == expected