[blivet:rhel7/master 1/2] A few simple unit tests for some formats methods (#1043763)

mulhern amulhern at redhat.com
Mon Dec 23 15:50:02 UTC 2013


Related: rhbz#1043763

Signed-off-by: mulhern <amulhern at redhat.com>
---
 tests/formats_test/__init__.py  |  0
 tests/formats_test/init_test.py | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 tests/formats_test/__init__.py
 create mode 100644 tests/formats_test/init_test.py

diff --git a/tests/formats_test/__init__.py b/tests/formats_test/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/formats_test/init_test.py b/tests/formats_test/init_test.py
new file mode 100644
index 0000000..0e174e8
--- /dev/null
+++ b/tests/formats_test/init_test.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+import unittest
+
+import blivet.formats as formats
+import blivet.errors as errors
+
+class FormatsTestCase(unittest.TestCase):
+
+    def setUp(self):
+        pass
+
+    def testFormatsMethods(self):
+        ##
+        ## get_device_format_class
+        ##
+        format_pairs = {
+           None : formats.DeviceFormat,
+           "bogus" : formats.DeviceFormat,
+           "biosboot" : formats.biosboot.BIOSBoot,
+           "BIOS Boot" : formats.biosboot.BIOSBoot,
+           "nodev" : formats.fs.NoDevFS
+           }
+        format_names = format_pairs.keys()
+        format_values = [format_pairs[k] for k in format_names]
+
+        self.assertEqual(
+           [formats.get_device_format_class(x) for x in format_names],
+           format_values)
+
+        for name in format_names:
+            self.assertIs(formats.getFormat(name).__class__, format_pairs[name])
+
+def suite():
+    return unittest.TestLoader().loadTestsFromTestCase(FormatsTestCase)
-- 
1.8.3.1



More information about the anaconda-patches mailing list