def test_no_partition_table(self, log_mock, execute_mock): output = """ BYT; /dev/sda:500107862016B:scsi:512:4096:loop:ATA HGST HTS725050A7; 1:0.00MiB:476940MiB:476940MiB:ext4::; """ execute_mock.return_value = (output, "") result = disk_partitioner.get_partition_table("/dev/fake") self.assertEqual("loop", result) execute_mock.assert_called_once_with("parted", "-s", "-m", "/dev/fake", "print")
def test_no_partition_table(self, log_mock, execute_mock): output = """ BYT; /dev/sda:500107862016B:scsi:512:4096:loop:ATA HGST HTS725050A7; 1:0.00MiB:476940MiB:476940MiB:ext4::; """ execute_mock.return_value = (output, '') result = disk_partitioner.get_partition_table('/dev/fake') self.assertEqual('loop', result) execute_mock.assert_called_once_with('parted', '-s', '-m', '/dev/fake', 'print')
def has_partition_table(dev): return disk_partitioner.get_partition_table(dev) != 'loop'