Пример #1
0
def setup_disk_partitions():
    pt = the_disk.partition_table()
    partition_size = mb_to_sectors(10, the_disk.sector_size_in_bytes())
    pt.create_partition(0,partition_size ) # sector_size = 512 bytes . 20500 sectors are 10 mb
    pt.create_partition(partition_size+1,partition_size ) # sector_size = 512 bytes . 20500 sectors are 10 mb
    the_disk.format_partition(0, XJFileSystem)
    the_disk.format_partition(1, XJFileSystem)
Пример #2
0
 def test_when_delete_partition_then_partition_no_longer_exists(self):
     size = mb_to_sectors(10, 512)
     self.pt.create_partition(0, size)
     self.pt.delete_partition(0)
     self.assertEqual(len(self.pt.partition_entries()), 0)
Пример #3
0
 def test_when_create_partition_that_overlaps_another_then_raises_InvalidSectorRangeException(self):
     size = mb_to_sectors(10, 512)
     self.pt.create_partition(0, size)
     with self.assertRaises(InvalidSectorRangeException):
         self.pt.create_partition(10, size)
Пример #4
0
 def test_when_create_partition_then_it_has_one_partition(self):
     size = mb_to_sectors(10, 512)
     self.pt.create_partition(0, size)
     self.assertEqual(len(self.pt.partition_entries()), 1)