]>
Commit | Line | Data |
---|---|---|
3efd9988 FG |
1 | import pytest |
2 | from ceph_volume.devices import lvm | |
3 | ||
4 | ||
5 | class TestZap(object): | |
6 | ||
7 | def test_main_spits_help_with_no_arguments(self, capsys): | |
8 | lvm.zap.Zap([]).main() | |
9 | stdout, stderr = capsys.readouterr() | |
1adf2230 | 10 | assert 'Zaps the given logical volume(s), raw device(s) or partition(s)' in stdout |
3efd9988 FG |
11 | |
12 | def test_main_shows_full_help(self, capsys): | |
13 | with pytest.raises(SystemExit): | |
14 | lvm.zap.Zap(argv=['--help']).main() | |
15 | stdout, stderr = capsys.readouterr() | |
16 | assert 'optional arguments' in stdout | |
1adf2230 AA |
17 | |
18 | @pytest.mark.parametrize('device_name', [ | |
19 | '/dev/mapper/foo', | |
20 | '/dev/dm-0', | |
21 | ]) | |
22 | def test_can_not_zap_mapper_device(self, capsys, is_root, device_name): | |
23 | with pytest.raises(SystemExit): | |
24 | lvm.zap.Zap(argv=[device_name]).main() | |
25 | stdout, stderr = capsys.readouterr() | |
26 | assert 'Refusing to zap' in stdout |