Exemplo n.º 1
0
    def test_apply_specs_ignore_missing(self, install_specs):
        """Test the apply_specs method with ignored missing packages."""
        self.dnf_manager._ignore_missing_packages = True

        # Ignore a missing package.
        install_specs.side_effect = MarkingErrors(
            no_match_pkg_specs=["p1"]
        )

        self.dnf_manager.apply_specs(
            include_list=["@g1", "p1"],
            exclude_list=["@g2", "p2"]
        )

        install_specs.assert_called_once_with(
            install=["@g1", "p1"],
            exclude=["@g2", "p2"],
            strict=True
        )

        # Don't ignore a broken transaction.
        install_specs.side_effect = MarkingErrors(
            error_pkg_specs=["p1"]
        )

        with pytest.raises(BrokenSpecsError):
            self.dnf_manager.apply_specs(
                include_list=["@g1", "p1"],
                exclude_list=["@g2", "p2"]
            )
    def test_apply_specs_error(self, install_specs):
        """Test the apply_specs method with an error."""
        install_specs.side_effect = MarkingErrors(error_group_specs=["@g1"])

        with pytest.raises(BrokenSpecsError):
            self.dnf_manager.apply_specs(include_list=["@g1", "p1"],
                                         exclude_list=["@g2", "p2"])

        install_specs.side_effect = MarkingErrors(no_match_group_specs=["@g1"])

        with pytest.raises(MissingSpecsError):
            self.dnf_manager.apply_specs(include_list=["@g1", "p1"],
                                         exclude_list=["@g2", "p2"])
    def test_disable_modules_error(self, module_base_disable):
        """Test the failed enable_modules method."""
        module_base_disable.side_effect = MarkingErrors(
            module_depsolv_errors=["e1", "e2"])

        with pytest.raises(BrokenSpecsError):
            self.dnf_manager.disable_modules(module_specs=["m1", "m2:latest"])
Exemplo n.º 4
0
    def apply_specs_error_test(self, install_specs):
        """Test the apply_specs method with an error."""
        install_specs.side_effect = MarkingErrors(error_group_specs=["@g1"])

        with self.assertRaises(MarkingErrors):
            self.dnf_manager.apply_specs(include_list=["@g1", "p1"],
                                         exclude_list=["@g2", "p2"])
Exemplo n.º 5
0
    def disable_modules_error_test(self, module_base_disable):
        """Test the failed enable_modules method."""
        module_base_disable.side_effect = MarkingErrors(
            module_depsolv_errors=["e1", "e2"])

        with self.assertRaises(MarkingErrors):
            self.dnf_manager.disable_modules(module_specs=["m1", "m2:latest"])