Beispiel #1
0
    def create_partitioning(self, method: PartitioningMethod):
        """Create a new partitioning.

        Allowed values:
            AUTOMATIC
            CUSTOM
            MANUAL
            INTERACTIVE
            BLIVET

        :param PartitioningMethod method: a partitioning method
        :return: a partitioning module
        """
        module = PartitioningFactory.create_partitioning(method)

        # Update the module.
        module.on_storage_changed(self._current_storage)
        module.on_selected_disks_changed(
            self._disk_selection_module.selected_disks)

        # Connect the callbacks to signals.
        self.storage_changed.connect(module.on_storage_changed)
        self.partitioning_reset.connect(module.on_partitioning_reset)
        self._disk_selection_module.selected_disks_changed.connect(
            module.on_selected_disks_changed)

        # Update the list of modules.
        self._add_created_partitioning(module)
        return module
 def create_partitioning_test(self):
     """Test create_partitioning."""
     for method in PartitioningMethod:
         module = PartitioningFactory.create_partitioning(method)
         self.assertIsInstance(module, PartitioningModule)
         self.assertIsInstance(module.for_publication(), PartitioningInterface)
         self.assertEqual(module.partitioning_method, method)
 def test_create_partitioning(self):
     """Test create_partitioning."""
     for method in PartitioningMethod:
         module = PartitioningFactory.create_partitioning(method)
         assert isinstance(module, PartitioningModule)
         assert isinstance(module.for_publication(), PartitioningInterface)
         assert module.partitioning_method == method
 def failed_partitioning_test(self):
     """Test failed create_partitioning."""
     with self.assertRaises(ValueError):
         PartitioningFactory.create_partitioning("INVALID")
 def test_failed_partitioning(self):
     """Test failed create_partitioning."""
     with pytest.raises(ValueError):
         PartitioningFactory.create_partitioning("INVALID")