<META NAME="robots" CONTENT="noindex,nofollow">


<br />
<b>Warning</b>:  file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
 in <b>/home/familylifersmpc/htdocs/www.familylifersmpc.com/index.php</b> on line <b>91</b><br />
# flake8: noqa
import json
import yaml

import pytest

from ceph.deployment.hostspec import HostSpec, SpecValidationError


@pytest.mark.parametrize(
    "test_input,expected",
    [
        ({"hostname": "foo"}, HostSpec('foo')),
        ({"hostname": "foo", "labels": "l1"}, HostSpec('foo', labels=['l1'])),
        ({"hostname": "foo", "labels": ["l1", "l2"]}, HostSpec('foo', labels=['l1', 'l2'])),
        ({"hostname": "foo", "location": {"rack": "foo"}}, HostSpec('foo', location={'rack': 'foo'})),
    ]
)
def test_parse_host_specs(test_input, expected):
    hs = HostSpec.from_json(test_input)
    assert hs == expected


@pytest.mark.parametrize(
    "bad_input",
    [
        ({"hostname": "foo", "labels": 124}),
        ({"hostname": "foo", "labels": {"a", "b"}}),
        ({"hostname": "foo", "labels": {"a", "b"}}),
        ({"hostname": "foo", "labels": ["a", 2]}),
        ({"hos