コード例 #1
0
 def test_get_partitions(self, disk_number):
     from infi.diskmanagement.ioctl.structures import DRIVE_LAYOUT_INFORMATION_EX
     with self._ioctl_disk_get_drive_layout_ex as mock:
         with open("drive_layout_{}".format(disk_number), 'rb') as fd:
             mock.return_value = DRIVE_LAYOUT_INFORMATION_EX.create_from_string(fd.read())
             io = Disk(1)
             partitions = io.get_partitions()
             for partition in partitions:
                 self.assertIn(partition._struct.PartitionStyle, [0, 1, ])
コード例 #2
0
    def test_get_partitions(self, disk_number):
        from infi.diskmanagement.ioctl.structures import DRIVE_LAYOUT_INFORMATION_EX

        with self._ioctl_disk_get_drive_layout_ex as mock:
            with open("drive_layout_{}".format(disk_number), "rb") as fd:
                mock.return_value = DRIVE_LAYOUT_INFORMATION_EX.create_from_string(fd.read())
                io = Disk(1)
                partitions = io.get_partitions()
                for partition in partitions:
                    self.assertIn(partition._struct.PartitionStyle, [0, 1])
コード例 #3
0
class ThirdDriveLayoutTestCase(FirstDriveLayoutTestCase):
    def setUp(self):
        unittest.TestCase.setUp(self)
        self._disk = Disk(2)

    def test_get_partitions(self):
        actual = self._disk.get_partitions()
        self.assertEqual(len(actual), 1)

    def test_type(self):
        self.assertTrue(self._disk.is_gpt())
コード例 #4
0
class ThirdDriveLayoutTestCase(FirstDriveLayoutTestCase):
    def setUp(self):
        unittest.TestCase.setUp(self)
        self._disk = Disk(2)

    def test_get_partitions(self):
        actual = self._disk.get_partitions()
        self.assertEqual(len(actual), 1)

    def test_type(self):
        self.assertTrue(self._disk.is_gpt())
コード例 #5
0
class FirstDriveLayoutTestCase(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        super(FirstDriveLayoutTestCase, cls).setUpClass()
        if socket.gethostname() != 'host-ci38':
            raise unittest.SkipTest("This test case should run only on host-ci38")

    def setUp(self):
        unittest.TestCase.setUp(self)
        self._disk = Disk(0)

    def test_get_partitions(self):
        actual = self._disk.get_partitions()
        self.assertEqual(len(actual), 1)

    def test_type(self):
        self.assertTrue(self._disk.is_mbr())
コード例 #6
0
class FirstDriveLayoutTestCase(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        super(FirstDriveLayoutTestCase, cls).setUpClass()
        if socket.gethostname() != 'host-ci38':
            raise unittest.SkipTest(
                "This test case should run only on host-ci38")

    def setUp(self):
        unittest.TestCase.setUp(self)
        self._disk = Disk(0)

    def test_get_partitions(self):
        actual = self._disk.get_partitions()
        self.assertEqual(len(actual), 1)

    def test_type(self):
        self.assertTrue(self._disk.is_mbr())