fix(wallaper_changer): remove hostname

This commit is contained in:
Lucas Vivo committed 2026-11-20 15:58:04 +01:00
1 parent 5223bf030f
commit dcbf8c8be0
1 file changed
+17 -7
+17 -7
View File
@@ -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()