Exemple #1
0
def test_parse_host_specs(bad_input):
    with pytest.raises(SpecValidationError):
        hs = HostSpec.from_json(bad_input)
Exemple #2
0
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)
Exemple #3
0
def test_parse_host_specs(test_input, expected):
    hs = HostSpec.from_json(test_input)
    assert hs == expected