blob: c56896a187da41792d7edd9352e5b220200d9d6a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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"
|