def test_map_partitions(self): self.disk.add_part(1, 1023, 'ext3', '/') self.disk.partition() self.disk.map_partitions() try: from VMBuilder.disk import detect_size self.assertEqual(detect_size(self.disk.partitions[0].filename), 1023000576) except: raise finally: self.disk.unmap()
def test_detect_size_loopback_dev(self): self.imgdev = run_cmd('losetup', '-f', '--show', self.tmpfile).strip() self.assertTrue(detect_size(self.imgdev), 5*1024)
def test_detect_size_file(self): self.assertTrue(detect_size(self.tmpfile), 5*1024)