From: mulhern amulhern@redhat.com
Related: #56
Signed-off-by: mulhern amulhern@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)