]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume tests validate parsing of cryptsetup
authorAlfredo Deza <adeza@redhat.com>
Thu, 1 Feb 2018 20:51:41 +0000 (15:51 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Wed, 7 Feb 2018 14:46:47 +0000 (08:46 -0600)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit cce6a12f4a0d8d9a3d7dcb509b42ed2536d9257f)

src/ceph-volume/ceph_volume/tests/util/test_encryption.py [new file with mode: 0644]

diff --git a/src/ceph-volume/ceph_volume/tests/util/test_encryption.py b/src/ceph-volume/ceph_volume/tests/util/test_encryption.py
new file mode 100644 (file)
index 0000000..3d84e55
--- /dev/null
@@ -0,0 +1,19 @@
+from ceph_volume.util import encryption
+
+
+class TestStatus(object):
+
+    def test_skips_unuseful_lines(self, stub_call):
+        out = ['some line here', '  device: /dev/sdc1']
+        stub_call((out, '', 0))
+        assert encryption.status('/dev/sdc1') == {'device': '/dev/sdc1'}
+
+    def test_removes_extra_quotes(self, stub_call):
+        out = ['some line here', '  device: "/dev/sdc1"']
+        stub_call((out, '', 0))
+        assert encryption.status('/dev/sdc1') == {'device': '/dev/sdc1'}
+
+    def test_ignores_bogus_lines(self, stub_call):
+        out = ['some line here', '  ']
+        stub_call((out, '', 0))
+        assert encryption.status('/dev/sdc1') == {}