diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-27 20:15:28 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-27 20:15:28 +0200 |
| commit | ca56303bde2dd11eb259f51c33b5d1d96495502e (patch) | |
| tree | aa34909e29d2d9c4d641a429d345eb14dd25fb63 /test_cal_notif.py | |
| parent | d6a988f86d84ae955140a42f91b811c48c3ea1c5 (diff) | |
| download | cal-notif-master.tar.gz cal-notif-master.zip | |
- daemon(): key the rescan on signature(cfg) and the current hour, not
just signature, so a quiet calendar keeps advancing its notification
window instead of going stale after ~1 day.
- load_overrides(): validate each value is a list of parseable durations,
raising ValueError(f"override {uid!r}: ...") otherwise; the daemon's
existing reload try/except keeps the previous config on failure.
- load_config(): validate the say/say_now voice templates format cleanly
against a stub summary/in, catching bad placeholders at load time.
- notify(): pass "--" to notify-send so a summary starting with "-" is
not parsed as an option.
- daemon(): rebuild voice_ready() on config reload so voice changes
(enabled, model path) apply without a restart.
- parse_choice(): lowercase input so "Reset"/"NONE" work from rofi -i.
- notify(): note the overlapping-say-children limitation with a
ponytail comment naming the upgrade path.
- README/spec: document the hourly rebuild and its effect on in-place
.ics edits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'test_cal_notif.py')
| -rw-r--r-- | test_cal_notif.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test_cal_notif.py b/test_cal_notif.py index 0bb647c..89ff1ee 100644 --- a/test_cal_notif.py +++ b/test_cal_notif.py @@ -79,6 +79,29 @@ def test_config(): raise AssertionError except ValueError: pass + p.write_text('[voice]\nsay = "Fra {minuti}: {summary}"\n') + try: + cn.load_config(p) + raise AssertionError + except ValueError: + pass + + +def test_overrides_validate(): + with tempfile.TemporaryDirectory() as d: + p = Path(d) / "overrides.toml" + p.write_text('"x" = ["1hour"]\n') + try: + cn.load_overrides(p) + raise AssertionError + except ValueError: + pass + p.write_text('"x" = "1h"\n') + try: + cn.load_overrides(p) + raise AssertionError + except ValueError: + pass def test_expand(): @@ -198,6 +221,8 @@ def test_choice(): assert cn.parse_choice("90m") == ["1h 30m"] assert cn.parse_choice("none") == [] assert cn.parse_choice("reset") is None + assert cn.parse_choice("Reset") is None + assert cn.parse_choice("NONE") == [] try: cn.parse_choice("soon") raise AssertionError |
