]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume tests.util verify ValidDevice validator
authorAlfredo Deza <adeza@redhat.com>
Thu, 23 Aug 2018 14:31:16 +0000 (10:31 -0400)
committerAndrew Schoen <aschoen@redhat.com>
Wed, 29 Aug 2018 19:03:26 +0000 (14:03 -0500)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 649903bdabe3ea04c499c3dbe6d1e9e7b8f82a23)

src/ceph-volume/ceph_volume/tests/util/test_arg_validators.py

index f989599c8b77297c132128246f3750bc0e6ff6c3..9f20edbf724c077808c3f9862cdf57f11cfcc16f 100644 (file)
@@ -96,3 +96,17 @@ class TestExcludeGroupOptions(object):
         )
         stdout, stderr = capsys.readouterr()
         assert 'Cannot use --filestore (filestore) with --bluestore (bluestore)' in stdout
+
+
+class TestValidDevice(object):
+
+    def setup(self):
+        self.validator = arg_validators.ValidDevice()
+
+    def test_path_is_valid(self, fake_call):
+        result = self.validator('/')
+        assert result.abspath == '/'
+
+    def test_path_is_invalid(self, fake_call):
+        with pytest.raises(argparse.ArgumentError):
+            self.validator('/device/does/not/exist')