def check_selection_test(self, kernel_getter): kernel_getter.return_value = None dnf_manager = Mock() selection = PackagesSelectionData() selection.core_group_enabled = False selection.environment = "e1" selection.packages = ["p1", "p2"] selection.excluded_packages = ["p3", "p4"] selection.groups = ["g1", "g2"] selection.excluded_groups = ["g3", "g4"] selection.modules = ["m1", "m2"] selection.disabled_modules = ["m3", "m4"] task = CheckPackagesSelectionTask(dnf_manager, selection) report = task.run() dnf_manager.clear_selection.assert_called_once_with() dnf_manager.disable_modules.assert_called_once_with(["m3", "m4"]) dnf_manager.enable_modules.assert_called_once_with(["m1", "m2"]) dnf_manager.apply_specs.assert_called_once_with( ["@e1", "@g1", "@g2", "p1", "p2"], ["@core", "@g3", "@g4", "p3", "p4"]) dnf_manager.resolve_selection.assert_called_once_with() self.assertEqual(report.get_messages(), [])
def _process_kickstart_packages_selection(self, data): """Process the kickstart packages selection.""" selection = PackagesSelectionData() selection.core_group_enabled = not data.packages.nocore selection.default_environment_enabled = data.packages.default if data.packages.environment is not None: selection.environment = data.packages.environment selection.packages = data.packages.packageList selection.excluded_packages = data.packages.excludedList for group in data.packages.groupList: selection.groups.append(group.name) if group.include == GROUP_ALL: selection.groups_package_types[ group.name] = GROUP_PACKAGE_TYPES_ALL if group.include == GROUP_REQUIRED: selection.groups_package_types[ group.name] = GROUP_PACKAGE_TYPES_REQUIRED for group in data.packages.excludedGroupList: selection.excluded_groups.append(group.name) self.set_packages_selection(selection) self.set_packages_kickstarted(data.packages.seen)
def check_no_selection_test(self, kernel_getter): kernel_getter.return_value = None dnf_manager = Mock() dnf_manager.default_environment = None selection = PackagesSelectionData() selection.default_environment_enabled = False selection.core_group_enabled = False task = CheckPackagesSelectionTask(dnf_manager, selection) report = task.run() dnf_manager.clear_selection.assert_called_once_with() dnf_manager.disable_modules.assert_called_once_with([]) dnf_manager.enable_modules.assert_called_once_with([]) dnf_manager.apply_specs.assert_called_once_with([], ["@core"]) dnf_manager.resolve_selection.assert_called_once_with() self.assertEqual(report.get_messages(), [])
def test_check_default_selection(self, kernel_getter): kernel_getter.return_value = "kernel" dnf_manager = Mock() dnf_manager.default_environment = "environment" selection = PackagesSelectionData() selection.default_environment_enabled = True selection.core_group_enabled = True task = CheckPackagesSelectionTask(dnf_manager, selection) report = task.run() dnf_manager.clear_selection.assert_called_once_with() dnf_manager.disable_modules.assert_called_once_with([]) dnf_manager.enable_modules.assert_called_once_with([]) dnf_manager.apply_specs.assert_called_once_with( ["@environment", "@core", "kernel"], []) dnf_manager.resolve_selection.assert_called_once_with() self.assertEqual(report.get_messages(), [])
def test_get_installation_specs_nocore(self): """Test the get_installation_specs function without core.""" data = PackagesSelectionData() data.core_group_enabled = False assert get_installation_specs(data) == ([], ["@core"])
def get_installation_specs_nocore_test(self): """Test the get_installation_specs function without core.""" data = PackagesSelectionData() data.core_group_enabled = False self.assertEqual(get_installation_specs(data), ([], ["@core"]))