[master 2/19] Some initial tests for LUKs format.

mulkieran installerbot-noreply at redhat.com
Thu Jun 18 21:04:03 UTC 2015


From: mulhern <amulhern at redhat.com>

Related: #56

Signed-off-by: mulhern <amulhern at redhat.com>
---
 tests/formats_test/luks_test.py | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100755 tests/formats_test/luks_test.py

diff --git a/tests/formats_test/luks_test.py b/tests/formats_test/luks_test.py
new file mode 100755
index 0000000..c4389f0
--- /dev/null
+++ b/tests/formats_test/luks_test.py
@@ -0,0 +1,29 @@
+import blivet.formats.luks as luks
+
+from tests import loopbackedtestcase
+
+class LUKSTestCase(loopbackedtestcase.LoopBackedTestCase):
+
+    def __init__(self, methodName='runTest'):
+        super(LUKSTestCase, self).__init__(methodName=methodName, deviceSpec=[self.DEFAULT_STORE_SIZE])
+        self.fmt = luks.LUKS(passphrase="passphrase", name="super-luks")
+
+    def testSimple(self):
+        """ Simple test of creation, setup, and teardown. """
+        # test that creation of format on device occurs w/out error
+        device = self.loopDevices[0]
+
+        self.assertFalse(self.fmt.exists)
+        self.fmt.device = device
+        self.assertIsNone(self.fmt.create())
+        self.assertIsNotNone(self.fmt.mapName)
+        self.assertTrue(self.fmt.exists)
+        self.assertTrue("LUKS" in self.fmt.name)
+
+        # test that the device can be opened once created
+        self.assertIsNone(self.fmt.setup())
+        self.assertTrue(self.fmt.status)
+
+        # test that the device can be closed again
+        self.assertIsNone(self.fmt.teardown())
+        self.assertFalse(self.fmt.status)


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/a57ff3af996dcf82b3a1ee2029af00348ed24f68


More information about the anaconda-patches mailing list