コード例 #1
0
ファイル: test_hostspec.py プロジェクト: gyaozhou/ceph-read
def test_parse_host_specs(bad_input):
    with pytest.raises(SpecValidationError):
        hs = HostSpec.from_json(bad_input)
コード例 #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)
コード例 #3
0
ファイル: test_hostspec.py プロジェクト: gyaozhou/ceph-read
def test_parse_host_specs(test_input, expected):
    hs = HostSpec.from_json(test_input)
    assert hs == expected