summaryrefslogtreecommitdiffstats
path: root/tests/test_settings.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-07-17 10:12:49 +0200
committerDanilo M. <danix@danix.xyz>2026-07-17 10:12:49 +0200
commitfa74bf36bd5cce6e86c9f38f71284d8d429cc5d6 (patch)
treeef0ede9d4945224badf3d03ac7a702f4a18b2f8a /tests/test_settings.py
parent7548ce1bfd4496d7cb035706307d709801a54a30 (diff)
downloadhyprsunset-qt-fa74bf36bd5cce6e86c9f38f71284d8d429cc5d6.tar.gz
hyprsunset-qt-fa74bf36bd5cce6e86c9f38f71284d8d429cc5d6.zip
feat: app settings INI
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_settings.py')
-rw-r--r--tests/test_settings.py26
1 files changed, 26 insertions, 0 deletions
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"