X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fceph-volume%2Fceph_volume%2Ftests%2Futil%2Ftest_arg_validators.py;fp=src%2Fceph%2Fsrc%2Fceph-volume%2Fceph_volume%2Ftests%2Futil%2Ftest_arg_validators.py;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=22b962b1d52d7f8f36e627d7e8e61269d27b9ae1;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py b/src/ceph/src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py deleted file mode 100644 index 22b962b..0000000 --- a/src/ceph/src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py +++ /dev/null @@ -1,53 +0,0 @@ -import pytest -import argparse -from ceph_volume import exceptions -from ceph_volume.util import arg_validators - - -invalid_lv_paths = [ - '', 'lv_name', '/lv_name', 'lv_name/', - '/dev/lv_group/lv_name' -] - - -class TestLVPath(object): - - def setup(self): - self.validator = arg_validators.LVPath() - - @pytest.mark.parametrize('path', invalid_lv_paths) - def test_no_slash_is_an_error(self, path): - with pytest.raises(argparse.ArgumentError): - self.validator(path) - - def test_is_valid(self): - path = 'vg/lv' - assert self.validator(path) == path - - def test_abspath_is_valid(self): - path = '/' - assert self.validator(path) == path - - -class TestOSDPath(object): - - def setup(self): - self.validator = arg_validators.OSDPath() - - def test_is_not_root(self): - with pytest.raises(exceptions.SuperUserError): - self.validator('') - - def test_path_is_not_a_directory(self, is_root, tmpfile, monkeypatch): - monkeypatch.setattr(arg_validators.disk, 'is_partition', lambda x: False) - validator = arg_validators.OSDPath() - with pytest.raises(argparse.ArgumentError): - validator(tmpfile()) - - def test_files_are_missing(self, is_root, tmpdir, monkeypatch): - tmppath = str(tmpdir) - monkeypatch.setattr(arg_validators.disk, 'is_partition', lambda x: False) - validator = arg_validators.OSDPath() - with pytest.raises(argparse.ArgumentError) as error: - validator(tmppath) - assert 'Required file (ceph_fsid) was not found in OSD' in str(error)