]>
git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/cephadm/tests/test_completion.py
13 from tests
import mock
14 from .fixtures
import cephadm_module
, wait
15 from ..module
import trivial_completion
, forall_hosts
18 class TestCompletion(object):
20 def test_trivial(self
, cephadm_module
):
24 assert wait(cephadm_module
, run(1)) == 2
26 def test_exception(self
, cephadm_module
):
31 with pytest
.raises(ValueError):
32 wait(cephadm_module
, c
)
34 @pytest.mark
.parametrize("input,expected", [
37 (["hallo"], ["('hallo',)"]),
38 ("hi", ["('h',)", "('i',)"]),
39 (list(range(5)), [str((x
, )) for x
in range(5)]),
40 ([(1, 2), (3, 4)], ["(1, 2)", "(3, 4)"]),
42 def test_async_map(self
, input, expected
, cephadm_module
):
44 def run_forall(*args
):
46 assert run_forall(input) == expected
49 @pytest.mark
.parametrize("input,expected", [
52 (["hallo"], ["('hallo',)"]),
53 ("hi", ["('h',)", "('i',)"]),
54 (list(range(5)), [str((x
, )) for x
in range(5)]),
55 ([(1, 2), (3, 4)], ["(1, 2)", "(3, 4)"]),
57 def test_async_map_self(self
, input, expected
, cephadm_module
):
63 def run_forall(self
, *args
):
67 assert Run().run_forall(input) == expected