summaryrefslogtreecommitdiff
path: root/tests/unittests/test_storage_config.py
diff options
context:
space:
mode:
authorOlivier Gayot <[email protected]>2025-02-12 16:46:49 +0100
committerOlivier Gayot <[email protected]>2025-02-21 09:36:08 +0100
commit4db0ef3f35051aa4879953b5ba5db567127272a4 (patch)
treeab60df34a76b1dd41d77677a05652eb53e9eec2f /tests/unittests/test_storage_config.py
parent872c8e6b79e4394849663079ddc1506710b66362 (diff)
storage-config: factorize detection of the partition layout
Signed-off-by: Olivier Gayot <[email protected]> (cherry picked from commit ee2d6f678d3f05ce685995a77e8a4a4b59cafcab)
Diffstat (limited to 'tests/unittests/test_storage_config.py')
-rw-r--r--tests/unittests/test_storage_config.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/unittests/test_storage_config.py b/tests/unittests/test_storage_config.py
index f9321c2d..61c8017c 100644
--- a/tests/unittests/test_storage_config.py
+++ b/tests/unittests/test_storage_config.py
@@ -143,6 +143,38 @@ class TestProbertParser(CiTestCase):
self.assertIsNotNone(bdparser(probe_data))
+ def test_detect_partition_scheme__unpartitioned(self):
+ blockdev = {
+ "DEVNAME": "/dev/sda",
+ "DEVTYPE": "disk",
+ }
+ self.assertIsNone(baseparser.detect_partition_scheme(blockdev))
+
+ def test_detect_partition_scheme__gpt(self):
+ blockdev = {
+ "DEVNAME": "/dev/sda",
+ "DEVTYPE": "disk",
+ "ID_PART_TABLE_TYPE": "gpt",
+ }
+ self.assertEqual("gpt", baseparser.detect_partition_scheme(blockdev))
+
+ def test_detect_partition_scheme__dos(self):
+ blockdev = {
+ "DEVNAME": "/dev/sda",
+ "DEVTYPE": "disk",
+ "ID_PART_TABLE_TYPE": "dos",
+ }
+ self.assertEqual("dos", baseparser.detect_partition_scheme(blockdev))
+
+ def test_detect_partition_scheme__something_else(self):
+ blockdev = {
+ "DEVNAME": "/dev/sda",
+ "DEVTYPE": "disk",
+ "ID_PART_TABLE_TYPE": "foobar",
+ }
+ self.assertEqual(
+ "unsupported", baseparser.detect_partition_scheme(blockdev))
+
def _get_data(datafile):
data = util.load_file('tests/data/%s' % datafile)