From dcbf8c8be03b17c9135d39ba7f9709bf27b02294 Mon Sep 17 00:00:00 2001 From: Lucas Vivo Date: Sun, 15 Nov 2026 21:43:24 +0100 Subject: [PATCH] fix(wallaper_changer): remove hostname --- wallpaper_changer/tests/unit/test_config.py | 24 +++++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/wallpaper_changer/tests/unit/test_config.py b/wallpaper_changer/tests/unit/test_config.py index 8c4013f..c0af91f 100644 --- a/wallpaper_changer/tests/unit/test_config.py +++ b/wallpaper_changer/tests/unit/test_config.py @@ -68,8 +68,7 @@ class ConfigTests(unittest.TestCase): (("x", "/tmp/custom-wallpapers"), "/tmp/custom-wallpapers", Path("/tmp/custom-wallpapers")), ) - with patch("wallpaper_changer.config.socket.gethostname", return_value="testhost"), \ - patch("pathlib.Path.home", return_value=home): + with patch("pathlib.Path.home", return_value=home): for (mode, folder), expected_folder, expected_img_dir in cases: with self.subTest(mode=mode, folder=folder): arguments = [ @@ -86,7 +85,6 @@ class ConfigTests(unittest.TestCase): config = Config.load(args) - self.assertEqual(config.host, "testhost") self.assertEqual(config.img_folder, expected_folder) self.assertEqual(config.img_dir, expected_img_dir) self.assertEqual(config.wallpaper_dir, Path("/tmp/wallpaper-cache/wallpaper")) @@ -98,8 +96,7 @@ class ConfigTests(unittest.TestCase): args.private_key = None args.conf_dir = home - with patch("wallpaper_changer.config.socket.gethostname", return_value="testhost"): - config = Config.load(args) + config = Config.load(args) self.assertEqual(config.private_key, Path(args.conf_dir).expanduser().resolve() / "IMG_privateKey.pem") self.assertEqual(config.wallpaper_dir, Path(args.conf_dir).expanduser().resolve() / "wallpaper") @@ -111,8 +108,7 @@ class ConfigTests(unittest.TestCase): assets = Path(__file__).resolve().parents[1] / "assets" args.private_key = assets / "test_privateKey.pem" - with patch("wallpaper_changer.config.socket.gethostname", return_value="testhost"), \ - patch("pathlib.Path.home", return_value=home): + with patch("pathlib.Path.home", return_value=home): config = Config.load(args) self.assertEqual(config.private_key, args.private_key) @@ -148,5 +144,19 @@ class VersionArgumentTests(unittest.TestCase): ) +class ArgumentParserConfigPrecedenceTests(unittest.TestCase): + def test_command_line_arguments_override_config_file(self) -> None: + """Verify explicit command-line values take precedence over config values.""" + self.skipTest("TODO: assert config and command-line precedence") + + def test_config_file_comments_and_quoted_values_are_parsed(self) -> None: + """Verify shell-style comments and quoted config values are parsed.""" + self.skipTest("TODO: cover shlex config parsing") + + def test_invalid_config_arguments_are_reported(self) -> None: + """Verify invalid options in the selected config file are reported.""" + self.skipTest("TODO: assert invalid-config error handling") + + if __name__ == "__main__": unittest.main()