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)
 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)
 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)
 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)