diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_settings.py | 26 |
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" |
