From: Alfredo Deza Date: Wed, 23 Aug 2017 17:29:15 +0000 (-0400) Subject: ceph-volume tests create tests for the new arg validator X-Git-Tag: v13.0.0~16^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d5eb9640aa4b20eabc9b5fdd07559082346478c6;p=ceph.git ceph-volume tests create tests for the new arg validator Signed-off-by: Alfredo Deza --- diff --git a/src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py b/src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py new file mode 100644 index 0000000000000..917469128da7e --- /dev/null +++ b/src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py @@ -0,0 +1,24 @@ +import pytest +import argparse +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