]>
git.proxmox.com Git - ceph.git/blob - ceph/src/ceph-volume/ceph_volume/tests/systemd/test_main.py
2 from ceph_volume
import exceptions
, conf
3 from ceph_volume
.systemd
.main
import parse_subcommand
, main
, process
6 class TestParseSubcommand(object):
8 def test_no_subcommand_found(self
):
9 with pytest
.raises(exceptions
.SuffixParsingError
):
12 def test_sub_command_is_found(self
):
13 result
= parse_subcommand('lvm-1-sha-1-something-0')
14 assert result
== 'lvm'
17 class Capture(object):
19 def __init__(self
, *a
, **kw
):
24 def __call__(self
, *a
, **kw
):
29 class TestMain(object):
32 conf
.log_path
= '/tmp/'
34 def test_no_arguments_parsing_error(self
):
35 with pytest
.raises(RuntimeError):
38 def test_parsing_suffix_error(self
):
39 with pytest
.raises(exceptions
.SuffixParsingError
):
42 def test_correct_command(self
, monkeypatch
):
44 monkeypatch
.setattr(process
, 'run', run
)
45 main(args
=['ceph-volume-systemd', 'lvm-8715BEB4-15C5-49DE-BA6F-401086EC7B41-0' ])
46 command
= run
.calls
[0][0]
50 '8715BEB4-15C5-49DE-BA6F-401086EC7B41-0'