SurfSense/surfsense_backend/tests/unit/automations
CREDO23 db4eef651f test(automations/templating): lock render, filters, environment, context
render.py (4): variable substitution, StrictUndefined raises on missing
keys, evaluate_predicate coerces to bool, render_value walks dicts/lists
and renders string leaves.

filters.py (4): slugify produces URL-safe output, date formats datetime
with strftime, date(None) → "" so templates can write
{{ inputs.last_fired_at | date }} on first run, date(str) passes through.

environment.py (4): the sandbox boundary — disallowed Jinja built-ins
(e.g. pprint) raise, and the finalize hook coerces non-string outputs
to predictable wire shapes (datetime → ISO, None → "", dict → JSON).

context.py (1): build_run_context exposes {run, inputs, steps} with the
exact shape every plan template body relies on.

13 tests total, all pure unit.
2026-05-28 19:03:22 +02:00
..
dispatch test(automations/dispatch): lock _validate_inputs + DispatchError 2026-05-28 19:03:00 +02:00
runtime test(automations/runtime): lock execute_step + with_retries 2026-05-28 19:03:08 +02:00
templating test(automations/templating): lock render, filters, environment, context 2026-05-28 19:03:22 +02:00
triggers test(automations/triggers): lock schedule cron + params 2026-05-28 19:02:52 +02:00