]>
git.proxmox.com Git - ceph.git/blob - ceph/src/ceph-volume/ceph_volume/tests/devices/test_zap.py
2 from ceph_volume
.devices
import lvm
3 from mock
.mock
import patch
, MagicMock
8 def test_main_spits_help_with_no_arguments(self
, capsys
):
10 stdout
, stderr
= capsys
.readouterr()
11 assert 'Zaps the given logical volume(s), raw device(s) or partition(s)' in stdout
13 def test_main_shows_full_help(self
, capsys
):
14 with pytest
.raises(SystemExit):
15 lvm
.zap
.Zap(argv
=['--help']).main()
16 stdout
, stderr
= capsys
.readouterr()
17 assert 'optional arguments' in stdout
19 @pytest.mark
.parametrize('device_name', [
23 @patch('ceph_volume.util.arg_validators.Device')
24 def test_can_not_zap_mapper_device(self
, mocked_device
, monkeypatch
, device_info
, capsys
, is_root
, device_name
):
25 monkeypatch
.setattr('os.path.exists', lambda x
: True)
26 mocked_device
.return_value
= MagicMock(
32 has_gpt_headers
=False,
35 with pytest
.raises(SystemExit):
36 lvm
.zap
.Zap(argv
=[device_name
]).main()
37 stdout
, stderr
= capsys
.readouterr()
38 assert 'Refusing to zap' in stderr