From fa74bf36bd5cce6e86c9f38f71284d8d429cc5d6 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 17 Jul 2026 10:12:49 +0200 Subject: feat: app settings INI Co-Authored-By: Claude Opus 4.8 --- tests/test_settings.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/test_settings.py (limited to 'tests/test_settings.py') diff --git a/tests/test_settings.py b/tests/test_settings.py new file mode 100644 index 0000000..c56896a --- /dev/null +++ b/tests/test_settings.py @@ -0,0 +1,26 @@ +from pathlib import Path +from hyprsunset_qt.settings import Settings + + +def test_defaults_created_on_first_run(tmp_path): + path = tmp_path / "config" + s = Settings.load(path) + assert path.exists() + assert s.auto_detect is True + assert s.daemon_command == "hyprsunset" + + +def test_roundtrip_and_tilde_expansion(tmp_path): + path = tmp_path / "config" + s = Settings.load(path) + s.lat = "45.07" + s.lon = "7.68" + s.auto_detect = False + s.cache_path = "~/somewhere/sun.json" + s.save(path) + + s2 = Settings.load(path) + assert s2.lat == "45.07" + assert s2.lon == "7.68" + assert s2.auto_detect is False + assert s2.cache_path_expanded() == Path.home() / "somewhere" / "sun.json" -- cgit v1.2.3