diff --git a/test/test_parameters.py b/test/test_parameters.py index 63cf33a4..b396b2be 100644 --- a/test/test_parameters.py +++ b/test/test_parameters.py @@ -2,8 +2,10 @@ # standard import unittest +from pathlib import Path # Project +from qgispluginci.exceptions import ConfigurationNotFound from qgispluginci.parameters import Parameters @@ -11,6 +13,26 @@ class TestParameters(unittest.TestCase): def test_changelog_parameters(self): """Test parameters for changelog command.""" # For the changelog command, the configuration file is optional. - parameters = Parameters.make_from(args={}, optional_configuration=True) - self.assertEqual("CHANGELOG.md", parameters.changelog_path) + # It mustn't raise an exception + parameters = Parameters.make_from( + args={}, + path_to_config_file=Path("does-not-exist.yml"), + optional_configuration=True, + ) self.assertIsNone(parameters.plugin_path) + self.assertEqual("CHANGELOG.md", parameters.changelog_path) + + def test_global_parameters(self): + """Test global parameters.""" + # A configuration file must exist. + with self.assertRaises(ConfigurationNotFound): + Parameters.make_from( + args={}, path_to_config_file=Path("does-not-exist.yml") + ) + + # Existing configuration file + parameters = Parameters.make_from( + args={}, path_to_config_file=Path("test/fixtures/pyproject.toml") + ) + self.assertEqual("qgis_plugin_CI_testing", parameters.plugin_path) + self.assertEqual("CHANGELOG.md", parameters.changelog_path)