class EighthDriveLayoutTestCase(FirstDriveLayoutTestCase): def setUp(self): unittest.TestCase.setUp(self) self._disk = Disk(7) def test_set_layout(self): layout = self._disk._get_layout() self._disk._set_layout(layout)
def test_get_layout(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) layout = io._get_layout() self.assertEqual(len(layout.PartitionEntry), EXPECTED_NUMBERS_OF_PARTITIONS[disk_number])
def test_get_layout(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) layout = io._get_layout() self.assertEqual(len(layout.PartitionEntry), EXPECTED_NUMBERS_OF_PARTITIONS[disk_number])
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, ])
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])
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())
def investigate(self, disk_number=0): 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: string = fd.read() mock.return_value = DRIVE_LAYOUT_INFORMATION_EX.create_from_string(string) io = Disk(1) layout = io._get_layout() self.assertEqual(layout.PartitionStyle, 0) # :0 self.assertEqual(layout.PartitionCount, 4) # :4 self.assertEqual(layout.union.Signature, 0xf35f23ba) # :8 partition = layout.PartitionEntry[0] self.assertEqual(partition.PartitionStyle, 0) # :48 # FIXME # For some reason, the offset of StartingOffset is before the 32nd byte # Maybe a bug in instruct? self.assertEqual(partition.StartingOffset.QuadPart, 0x100000) # :56
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())
def investigate(self, disk_number=0): 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: string = fd.read() mock.return_value = DRIVE_LAYOUT_INFORMATION_EX.create_from_string(string) io = Disk(1) layout = io._get_layout() self.assertEqual(layout.PartitionStyle, 0) # :0 self.assertEqual(layout.PartitionCount, 4) # :4 self.assertEqual(layout.union.Signature, 0xF35F23BA) # :8 partition = layout.PartitionEntry[0] self.assertEqual(partition.PartitionStyle, 0) # :48 # FIXME # For some reason, the offset of StartingOffset is before the 32nd byte # Maybe a bug in instruct? self.assertEqual(partition.StartingOffset.QuadPart, 0x100000) # :56
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())
def setUp(self): unittest.TestCase.setUp(self) self._disk = Disk(7)