Files
managed-portal/managed/store_dwell_alert/tests/test_notifier.py
2026-04-27 10:04:36 +08:00

16 lines
526 B
Python

import json
from app.modules.notifier import append_json_event
def test_append_json_event_writes_jsonl(tmp_path):
output = tmp_path / "logs" / "events.jsonl"
append_json_event(output, {"event": "long_stay_alert", "count": 5})
append_json_event(output, {"event": "half_hour_report", "count": 3})
lines = output.read_text(encoding="utf-8").splitlines()
assert json.loads(lines[0]) == {"event": "long_stay_alert", "count": 5}
assert json.loads(lines[1]) == {"event": "half_hour_report", "count": 3}