Done ! 403WebShell
403Webshell
Server IP : 194.181.228.65  /  Your IP : 216.73.216.87
Web Server : LiteSpeed
System : Linux wn13.webd.pl 5.14.0-687.46.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Sep 11 09:03:19 EDT 2026 x86_64
User : prusit ( 133039)
PHP Version : 5.6.40
Disable Function : exec, system, shell_exec, passthru, proc_open, proc_close, popen
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3.9/site-packages/ceph/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/ceph/tests/test_hostspec.py
# 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]}),
        ({"hostname": "foo", "location": "rack=bar"}),
        ({"hostname": "foo", "location": ["a"]}),
        ({"hostname": "foo", "location": {"rack", 1}}),
        ({"hostname": "foo", "location": {1: "rack"}}),
    ]
)
def test_parse_host_specs(bad_input):
    with pytest.raises(SpecValidationError):
        hs = HostSpec.from_json(bad_input)
    

Youez - 2016 - github.com/yon3zu
LinuXploit