def test_selection(self):
        # partition
        parent_device = Mock(type="disk", format=Mock(label_type="msdos", extended_partition=None))
        free_device = Mock(is_logical=False)
        advanced_options = AdvancedOptions(add_dialog=self.add_dialog, device_type="partition",
                                           parent_device=parent_device, free_device=free_device)

        advanced_options.partition_combo.set_active_id("extended")

        selection = advanced_options.get_selection()
        self.assertEqual(selection["parttype"], "extended")

        # lvm
        parent_device = Mock(type="disk", format=Mock(label_type="gpt", extended_partition=None))
        free_device = Mock(is_logical=False, size=Size("8 GiB"))
        advanced_options = AdvancedOptions(add_dialog=self.add_dialog, device_type="lvm",
                                           parent_device=parent_device, free_device=free_device)

        advanced_options.pesize_combo.set_active_id("64 MiB")

        selection = advanced_options.get_selection()
        self.assertEqual(selection["pesize"], Size("64 MiB"))

        # mdraid
        parent_device = Mock(type="disk", format=Mock(label_type="msdos", extended_partition=None))
        free_device = Mock(is_logical=False)
        advanced_options = AdvancedOptions(add_dialog=self.add_dialog, device_type="mdraid",
                                           parent_device=parent_device, free_device=free_device)

        advanced_options.chunk_combo.set_active_id("64 KiB")

        selection = advanced_options.get_selection()
        self.assertEqual(selection["chunk_size"], Size("64 KiB"))
Exemple #2
0
    def test_selection(self):
        # partition
        parent_device = Mock(type="disk", format=Mock(label_type="msdos", extended_partition=None))
        free_device = Mock(is_logical=False)
        advanced_options = AdvancedOptions(add_dialog=self.add_dialog, device_type="partition",
                                           parent_device=parent_device, free_device=free_device)

        advanced_options.partition_combo.set_active_id("extended")

        selection = advanced_options.get_selection()
        self.assertEqual(selection["parttype"], "extended")

        # lvm
        parent_device = Mock(type="disk", format=Mock(label_type="gpt", extended_partition=None))
        free_device = Mock(is_logical=False, size=Size("8 GiB"))
        advanced_options = AdvancedOptions(add_dialog=self.add_dialog, device_type="lvm",
                                           parent_device=parent_device, free_device=free_device)

        advanced_options.pesize_combo.set_active_id("64 MiB")

        selection = advanced_options.get_selection()
        self.assertEqual(selection["pesize"], Size("64 MiB"))