def test__message_format_whole_disk(self): image_info = _build_fake_image_info() msg = 'image ({0}) already present on device {1}' device = '/dev/fake' partition_uuids = {} result_msg = standby._message_format(msg, image_info, device, partition_uuids) expected_msg = ('image (fake_id) already present on device ' '/dev/fake') self.assertEqual(expected_msg, result_msg)
def test__message_format_whole_disk(self): image_info = _build_fake_image_info() msg = 'image ({}) already present on device {}' device = '/dev/fake' partition_uuids = {} result_msg = standby._message_format(msg, image_info, device, partition_uuids) expected_msg = ('image (fake_id) already present on device ' '/dev/fake') self.assertEqual(expected_msg, result_msg)
def test__message_format_partition_bios(self): image_info = _build_fake_partition_image_info() msg = ('image ({0}) already present on device {1} ') device = '/dev/fake' partition_uuids = {'root uuid': 'root_uuid', 'efi system partition uuid': None} result_msg = standby._message_format(msg, image_info, device, partition_uuids) expected_msg = ('image (fake_id) already present on device ' '/dev/fake root_uuid=root_uuid') self.assertEqual(expected_msg, result_msg)
def test__message_format_partition_bios(self): image_info = _build_fake_partition_image_info() msg = ('image ({}) already present on device {} ') device = '/dev/fake' partition_uuids = {'root uuid': 'root_uuid', 'efi system partition uuid': None} result_msg = standby._message_format(msg, image_info, device, partition_uuids) expected_msg = ('image (fake_id) already present on device ' '/dev/fake root_uuid=root_uuid') self.assertEqual(expected_msg, result_msg)
def test__message_format_whole_disk_missing_oserror(self, ident_mock): ident_mock.side_effect = OSError image_info = _build_fake_image_info() msg = 'image ({}) already present on device {}' device = '/dev/fake' partition_uuids = {} result_msg = standby._message_format(msg, image_info, device, partition_uuids) expected_msg = ('image (fake_id) already present on device ' '/dev/fake') self.assertEqual(expected_msg, result_msg)
def test__message_format_partition_uefi_netboot(self): image_info = _build_fake_partition_image_info() image_info['deploy_boot_mode'] = 'uefi' image_info['boot_option'] = 'netboot' msg = ('image ({}) already present on device {} ') device = '/dev/fake' partition_uuids = {'root uuid': 'root_uuid', 'efi system partition uuid': None} result_msg = standby._message_format(msg, image_info, device, partition_uuids) expected_msg = ('image (fake_id) already present on device ' '/dev/fake root_uuid=root_uuid') self.assertEqual(expected_msg, result_msg)
def test__message_format_partition_uefi_localboot(self): image_info = _build_fake_partition_image_info() image_info['deploy_boot_mode'] = 'uefi' image_info['boot_option'] = 'local' msg = ('image ({}) already present on device {} ') device = '/dev/fake' partition_uuids = {'root uuid': 'root_uuid', 'efi system partition uuid': 'efi_id'} result_msg = standby._message_format(msg, image_info, device, partition_uuids) expected_msg = ('image (fake_id) already present on device ' '/dev/fake root_uuid=root_uuid ' 'efi_system_partition_uuid=efi_id') self.assertEqual(expected_msg, result_msg)