Exemple #1
0
    def test_apply_selection_data(self):
        """Test the apply_selection_data method."""
        selection = PackagesSelectionData()
        selection.environment = "e1"
        selection.groups = ["g1", "g2", "g3"]

        self.cache.apply_selection_data(selection)
        self.assertEqual(self.cache.environment, "e1")
        self.assertEqual(self.cache.groups, ["g1", "g2", "g3"])
Exemple #2
0
    def get_selection_data(self) -> PackagesSelectionData:
        """Generate the selection data.

        :return: a packages selection data
        """
        selection = PackagesSelectionData()
        selection.environment = self.environment
        selection.groups = self.groups
        return selection
    def test_apply_selection_data_invalid_groups(self):
        """Test the apply_selection_data method with invalid groups."""
        self.dnf_manager.resolve_group.return_value = False

        selection = PackagesSelectionData()
        selection.environment = "e1"
        selection.groups = ["g1", "g2", "g3"]

        self.cache.apply_selection_data(selection)
        assert self.cache.environment == "e1"
        assert self.cache.groups == []
    def test_get_selection_data(self):
        """Test the get_selection_data method."""
        self.cache.select_environment("e1")
        self.cache.select_group("g1")
        self.cache.select_group("g2")
        self.cache.select_group("g3")

        expected = PackagesSelectionData()
        expected.environment = "e1"
        expected.groups = ["g1", "g2", "g3"]

        data = self.cache.get_selection_data()
        assert compare_data(data, expected)
Exemple #5
0
    def test_get_installation_specs_groups(self):
        """Test the get_installation_specs function with groups."""
        data = PackagesSelectionData()

        data.groups = ["g1", "g2", "g3"]
        data.excluded_groups = ["g4", "g5", "g6"]
        data.groups_package_types = {
            "g1": GROUP_PACKAGE_TYPES_REQUIRED,
            "g3": GROUP_PACKAGE_TYPES_ALL,
            "g4": GROUP_PACKAGE_TYPES_REQUIRED,
            "g6": GROUP_PACKAGE_TYPES_ALL,
        }

        assert get_installation_specs(data) == ([
            "@core", "@g1/mandatory,conditional", "@g2",
            "@g3/mandatory,default,conditional,optional"
        ], ["@g4", "@g5", "@g6"])