How Syn is tested: what the unit and end-to-end (E2E) suites cover, how they are isolated from the live system, how to run them, and how to add tests.
tests/requirements.py. Every requirement has an ID (AUTH-02, AC-03, …) and the doc it comes from (README, ACCESS_CONTROL, RISK_SCORING, CORRELATION, SETUP, USER_GUIDE).cd ~/netmon
/usr/bin/python3 tests/run_tests.py # everything (unit + e2e), refreshes the docs
/usr/bin/python3 tests/run_tests.py unit -v # unit only, verbose
/usr/bin/python3 tests/run_tests.py e2e # end-to-end only
/usr/bin/python3 tests/gen_docs.py --check # CI gate: every test tagged, every requirement covered
You can also use plain unittest: python3 -m unittest discover -s tests/unit -t tests (or -s tests/e2e).
What you need: Python 3.12 with the standard library only, plus openssl on the PATH. The E2E harness uses openssl to make a throw-away TLS certificate. Nothing needs pytest, node or a browser.
The runner exits 0 when every test passes. Expected failures are allowed, because they document known bugs (see §6). After the tests it does three things:
tests/.last_results.json, with the status of every test id.docs/TEST_TRACEABILITY.md with those statuses, and refreshes the inventory block at the end of this file.tests/ and the live DB backups in baseline/backup/ must be unchanged by the run. If they changed, the runner prints a WARNING and exits 1.ship.shEvery ./ship.sh "msg" runs the test gate as step 0, before the security scan and before anything is staged:
| Step | What happens | On failure |
|---|---|---|
| 0 | tests/run_tests.py all (log in baseline/tests-last.txt) |
exit 7: lists the failing tests; nothing is committed |
| 0 | tests/gen_docs.py --check (traceability) |
exit 8: an untagged test, an unknown REQ id or a requirement with no test |
| 3 | the commit message gets a Tests: Ran N tests … OK line |
— |
5 (only with --deploy) |
the read-only container checks run against the redeployed dashboard (log in baseline/tests-deploy.txt) |
exit 9: a warning only, because the push has already landed |
--force does not skip the tests. In an emergency, --skip-tests does; the commit then says Tests: not run (--skip-tests). The docs regenerated by the run (TEST_TRACEABILITY.md and the inventory below) are committed together with the change.
Every test module imports tests/_env.py first, before any Syn module. It points the environment at a temporary directory:
| Variable | Test value | Why |
|---|---|---|
STATE_DIR, NETMON_DB |
<tmp>/state, <tmp>/state/netmon.db |
never the live dashboard/state/netmon.db |
NETMON_LLM |
off |
no local model server calls and no event reviewer threads |
NETMON_INTEGRATIONS |
<tmp>/state/integrations.json |
no Elasticsearch or UniFi credentials, so no network |
NETMON_BACKUP_DIR |
<tmp>/backup |
analyze.py calls store.backup(), which writes to the live baseline/backup/ by default |
NETMON_DIR |
the checkout | code only; data/*.json paths resolve to docs in the temp DB |
The temp directory is deleted when the tests exit. To keep it for debugging, set NETMON_TEST_KEEP=1. _env.fresh_db() empties the temp DB, except the meta table, and clears the store and site caches.
Test data. tests/fixtures.py builds synthetic, site-neutral data:
collect.py writes.10.0.0.0/8 or the RFC 5737 documentation ranges.fixtures.mac(i).As a result, no literal MAC, site IP or host name gets into git, and ship.sh/repo_guard.py stay clean.
tests/unit/)Unit tests run in the same process as the module they test, one module at a time, against the temp DB. Network calls (cloud LLM, web push) are replaced with stubs, and each test restores whatever it replaced.
| Area | File | What is verified |
|---|---|---|
| Store | test_store.py |
connection and 0600 permissions, docs table (jload/jdump/jglob), cfg flatten/build round trip, check-offs, mute and suppress rules, alert lifecycle, push prefs, security findings, registry and history, backup/stats/migrate/export |
| Config | test_config.py |
site_cfg defaults, public subset and cache; window time ranges; lookback 1–24 h validation; review_cfg schedule grid, modes and migration; research_cfg caps |
| Review / research split | test_review_noai.py |
the review job’s event reviewer only copies or queues (no web, no new notes, the event reviewer’s model); research.py needs --event; the scheduler never schedules research and starts a waiting Send to research click |
| Auth | test_auth.py |
scrypt hashing, username/password rules, roles and role migration, last-admin and self-demotion rules, first-start seeding, signed sessions (tampering, expiry, revocation), login throttling, self-service password change, private read marker |
| Audit | test_audit.py |
secret redaction (nested, length and depth caps), entry builders, spooling while ES is unreachable (0600, oldest-first replay, partial failure, size cap), never raises |
| Push targeting | test_push_targeting.py |
alert_targets, device_ids, watch_ids (follows DHCP changes), alert_for, pushsvc.run_once delivery per user |
| Risk | test_risk.py |
zone mapping, MAC-keyed segmentation flows, vulnerability score factors and cap, host score components and caps; reproduces the RISK_SCORING.md worked example (85.9 / 39.2 / 45.9) |
| Fix list | test_issues.py |
plaintext services, legacy TLS, external DNS/DoH, capture loss, tracking across snapshots (recurring, fixed, stable by MAC) |
| Lateral | test_lateral.py |
admin-session levels, allow and clear downgrades, edge scores, merge_periods |
| Baseline analysis | test_analyze.py |
dev_key, compact, med/mad/spike (with range scaling), tunnel and beacon helpers |
| Correlation | test_correlate.py |
artifact extraction, FNV-1a ids, build() linking rules, time window, per-type caps |
| ATT&CK | test_mitre.py |
the catalog loads, every rule maps to a real technique, rules_for/tags_for |
| AI parsing | test_llm_parsing.py |
defensive JSON extraction, verdict/priority normalisation, provider URL and pricing helpers |
| Repo guard | test_repo_guard.py |
detection of forbidden files, MACs, site IPs and sensitive terms |
| Scheduler | test_scheduler.py |
review-job slot grid, next_run, watcher and weekly timing (no jobs are started) |
| Static assets | test_static_assets.py |
every <script>/<link> in the HTML exists; JS fnv() matches Python |
| Settings: Integrations (Elasticsearch, UniFi, audit) | test_settings_integrations.py |
URL / index / key validation, per-index overrides and fallbacks, write-only API keys with host-secret and env fallbacks, audit index rules and send switches, save stamps, stubbed connection tests, and the audit reviewer/researcher switches end to end through audit.emit and the Review log card |
| Settings (AI pipeline) | test_settings_ai.py |
Every AI-pipeline setting: event reviewer notes limits, reviewer / chat models, chat Elasticsearch, look-ups first, web and Elasticsearch look-ups, review limits (pair modes, max links, window, retention, classify, view), decision-model on/off and thresholds, AI providers (validation, write-only masked keys, delete, local server) and decision-model server settings: defaults, read-back, range checks, user stamp and effect on the pipeline |
| Settings: Site & network policy documents | test_settings_site.py |
settings_docs catalog vs the *.example.json templates and site defaults, cfg_save/cfg_load round trip, cfg_validate per document (zones, roles, spike/upload/beacon thresholds, allow rules, regexes, site, known benign) incl. 3 known validation gaps, the /api/config/cfg path/size/role guards, auto-tune recommend (no writes) and apply (accepted values only), and UniFi discover build/apply with stubbed UniFi (zones per subnet, roles, classes, merge vs overwrite, prefixes) |
| Settings inventory | test_settings_inventory.py |
every settings POST endpoint, Integrations section, Settings-page document and setter function found in the code is listed in tests/settings_inventory.py, and every listed setting has tests behind its requirements (SET-90) |
| Lateral | test_lateral_page.py | node/gateway naming, gateway/UDP/scan port rules, allow rules, cleared flows and suppress rules, internet hosts off the graph, admin port rows, node counters, host-name resolver, lateral_periods() against a stub broker, and lateral.js (filters, KPIs, p= periods, legend, SVG graph, Clear column, Admin access, Cleared segmentation, details panel) under node |
| Network pages | test_network_pages.py | zone_of and internal_traffic (flows, zone matrix, scans) with stubbed Elasticsearch; unifi.collect clients/flows/health with a stubbed controller; /api/history and /api/registry data; netmap.js host merge, zones, naming, decorations, colours, SVG nodes/links, panel, tiles and empty states under node; Traffic map matrix, flows, ASN/country/protocol totals, Gateway and trend sections, old bookmarks and User-role redirect under node |
| Alerts page | test_alerts_page.py | Legacy mute rules (matching alerts stored cleared/read/unpushed, remove restores only its alerts, creation refused), suppressed alerts hidden but correlated, 30-day window for every kind; watch.py run in-process against stubbed Elasticsearch/feeds/hosts (IDS sev-1/malware, new device, new Internet port, TI domain/SNI/IP, DNS tunnel, endpoint, failed admin logins, 12 h repeat mute, held detections); alerts.js under node: bell count/title, Mark all read, verdict chip and provenance, columns per role, research/notes/artifact cells, detections card KPIs/chips/filter, my-devices toggle, mute-rules card and cleared view, empty states, plain-feed fallback, device picker modes |
| Open events | test_open_events.py |
eventstore: upsert (seen once per snapshot, widening times, newest data wins, capped doc), Fix-list close/reopen (sync_vulns), grouping keys (_norm/gkey, segmentation flow key), list order, type/severity/text filters, limit and count-only, collapsed repeats, ack_refs/k_in, check-offs hiding events (event, group, Posture variant, cleared seg flow), live-alert filter, display merges (N variants, -> multiple devices), extras, related, detail, decision inputs, USER_GET excludes /api/events/*; openevents.js under node (cards per type, columns, empty state, every correlate type has a card) (OE-01..OE-16) |
| Posture: snapshots | test_posture.py |
server.snapshot/_snapshot/snapshots: companions, bad/traversal ids, every Posture section present, findings’ last_seen (POS-01, POS-02, POS-13) |
| Posture: time ranges | test_posture.py |
snap_window, range_request (nightly ±10 min vs host broker, stubbed corr_llm.broker; validation), base_snapshot/resolve_sid, range_snapshot, range_skeleton, range_section (POS-03..POS-06) |
| Posture: suppress rules | test_posture.py |
seg_filter (copy, MAC->IP), store.ids_filter through snapshot() incl. host rules, rules apply to every snapshot/range, filter failure is non-fatal (POS-07..POS-10) |
| Posture: cleared segmentation / check-offs | test_posture.py |
ClearedSet, with_cleared (acks + rules + MAC->IP, store failure), write_ack/read_acks range-independent and not filtering server data (POS-11, POS-12) |
| Posture: app.js (node) | test_posture.py |
ackSplit, ACK keys / acked (fnv = correlate.fnv), segKey/segFlowKey/ackRef, baseFind, hfHost/hfTo Host/To columns, V.security box order; skipped without node (POS-02, POS-14..POS-18) |
| Event firings | test_event_fires.py |
es_sourced: only Elasticsearch-sourced types fire; IDS fires once per new alert time; overlapping finding windows extend one firing, separate windows add a new one; seen-N count; Open events detail keeps each merged link’s review time (llm_ats) for per-firing scoping |
| Alerts view | test_alerts_view.py |
alert_ref, verdict order (person > event reviewer > decision model > unreviewed), web_research (own vs candidate, manual-test excluded, http(s) links only, per cap), alert_view (look-up repeats merged with a times count, people’s notes trimmed, artifact notes stored once), detections (verdict counts, filter, limit) |
| Event reviewer output / Review log | test_reviewer_output.py |
one-paragraph prompt and schema (no per-link reason), clef.event_state kept count, corr_llm._touch distinct events, review.Status.finish counts reaching reviewlog.job_runs |
| Box info texts | test_cardinfo_keys.py |
AI pipeline part boxes have aireview\|/aiconfig\| ⓘ keys with what/source/use; Alerts/Configuration boxes resolve to ⓘ keys (2 known gaps marked expected failure) |
tests/e2e/)E2E tests run Syn the way production does: as separate processes that talk over the network.
Harness (tests/e2e/harness.py):
Server starts the real dashboard/app/server.py with:
openssl,DASH_USER/DASH_PASS.It waits for /healthz before the tests start and stops the process when they finish. Code passed as seed= runs inside the server’s environment before the server starts, for example to write snapshots.
Client is a small HTTPS client with a cookie jar. It sends the dashboard’s CSRF header (X-Netmon: 1).| File | Scenario |
|---|---|
test_e2e_dashboard.py |
Transport: TLS 1.2 or later (TLS 1.1 refused), security headers on every kind of response, /healthz. Sign-in: cookie flags, generic error messages, throttling per client (via CF-Connecting-IP), logout, tampered cookies, CSRF guard, malformed JSON. Pages: build-hash stamping, path traversal, 404s, gzip. API: every data view returns JSON with the LLM off; risk scores stay in 0–100; seeded findings reach correlation and Open events. Check-offs: round trip. Password change: self-service change revokes other sessions and stores an account alert. |
test_e2e_access_control.py |
Roles: the full role matrix, using accounts created through the admin API. A User is limited to the allow-lists; a defender can read everything but can’t change settings. User scope: only the user’s devices’ alerts, a reduced site config, locked prefs, a private read marker. User admin: validation, least-privilege default, a role change applies on the next request, no self-demotion, deleting a user revokes their session, password reset. Audit trail: POSTs, failed logins and 403s are spooled with secrets redacted; the spool file and the DB are 0600. |
test_e2e_pipeline.py |
analyze.py over five daily snapshots: the baseline seeds and then becomes ready, a day-5 upload spike is flagged and keyed by MAC, steady devices aren’t flagged, history is appended, and the backup lands in the sandbox. The dashboard then serves that output. Server lifecycle: the first start seeds the admin and later starts ignore the env vars; accounts without a role are migrated to admin; console set-role (the last admin is protected); add-user reads the password from a pty; the server starts with the LLM off. CLIs: store.py check/stats, scheduler.py status, repo_guard.py. |
test_e2e_container.py |
The deployed container, read-only. docker inspect shows a read-only root filesystem, a non-root user, cap-drop ALL, no-new-privileges and a healthy healthcheck. The live /healthz, /login and the 401 for unauthenticated requests all answer. These tests skip themselves when docker or the container isn’t present. |
test_e2e_settings.py |
Every admin settings endpoint of the real dashboard over HTTPS: save and read back (integrations, lookback, review schedule/job, research limits, auto-close, settings documents, auto-tune, AI providers/models, event reviewer look-ups, web cache, decision model, notes, consolidation, review limits, notification devices), keys masked, invalid input 400 with nothing changed, defender/user 403, audit entry per POST with keys redacted (loopback fake Elasticsearch) |
| test_e2e_lateral.py | /api/lateral for a seeded snapshot (levels from the stored policy and allow rule), 404 on unknown ids, admin/defender 200 vs user 403 vs anonymous 401, p= periods merged through a loopback stub broker, 400 on bad periods or a broker error, clearing a segmentation flow via /api/acks |
| test_e2e_network.py | Real server seeded with snapshots, a time range, policy, registry and history: snapshot internal/matrix/UniFi data, range sections, registry and history APIs, Network menu links and scripts, User 403 vs defender/admin 200 |
| test_e2e_alerts.py | Real server seeded with alarms, held watcher detections, mute-cleared and suppressed alerts, registry devices and AI verdicts: feed order/limit/hidden rows, my-devices mine flags (defender), User scope with cleared/held/extra ignored, extra=1 verdicts, held=1 detections and v= filter, cleared view rule names, mute rules list and remove (defender) restoring alerts, private vs shared read markers, page script per role |
test_e2e_open_events.py |
Real server with a seeded store: /api/events/open order, collapsed and merged rows, type/sev/q filters, default 2000 / cap 5000 / limit=0, check-off and restore via /api/acks, /detail, /inputs, /related (12-member cap), admin+defender 200 / user 403 / anonymous 401; two expected failures for negative and non-numeric limit (OE-03..OE-05, OE-07, OE-09, OE-11..OE-14, OE-17, OE-18) |
test_e2e_posture.py |
One server seeded with two nightly snapshots + one collected range: /api/snapshot?id=latest carries every Posture box; /api/snapshots order and 404s; range follows its nightly report (base); /api/section slicing; /api/range nightly window vs no broker (400) (POS-01, POS-02, POS-04..POS-06) |
test_e2e_posture.py |
Segmentation and IDS suppress rules via /api/llm/review-limits hide rows in every snapshot and range, removal restores them; invalid rules 400 (POS-07, POS-09, POS-10, POS-20) |
test_e2e_posture.py |
Check-offs (single and bulk seg) persist across nightly reports and ranges and are shared between accounts; User role gets 403 on snapshot/section/acks/suppress/range, defender can edit rules (POS-11, POS-12, POS-19) |
Deliberately not covered by E2E:
collect.py, extras.py, unifi.py, hosts.py),ship.sh, which commits and pushes.These need live credentials or have external side effects. Their logic is unit-tested, and the network edge is stubbed.
tests/unit/test_<module>.py or tests/e2e/test_e2e_<scenario>.py. The first lines must be:
import os, sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import _env # noqa: E402 - isolation, before any Syn import
REQ: line:
def test_user_cannot_check_off(self):
"""A User gets 403 when checking an item off.
REQ: AC-03"""
tests/requirements.py first. gen_docs.py --check fails if any requirement has no test, or if any test has no tag or an unknown tag._env.fresh_db() when you need an empty store. Don’t put literal MACs, site IPs or realistic secrets in test files.set_*/put/save function), add it to tests/settings_inventory.py with the requirements that cover it. test_settings_inventory.py fails until you do, and fails while any listed setting has no test.tests/run_tests.py. It refreshes both docs, including the generated Settings coverage table.These tests are marked @unittest.expectedFailure. Once a bug is fixed, the runner reports UNEXPECTED PASS; remove the decorator then.
| Test | Bug |
|---|---|
test_correlate – test_fnv_matches_js_for_astral_characters |
correlate.fnv hashes code points, but app.js hashes UTF-16 code units. An alarm title containing an emoji therefore gets a different event id in Python than in the browser. Fix: hash UTF-16 units, as corr_llm._fnv does. |
test_store (cfg round trip) |
cfg_flatten/cfg_build lose a top-level empty-string key. Minor. |
test_analyze – test_value_equal_to_floor_counts |
analyze.spike() uses >, but extras.SPIKE_COMMON documents “at least min”. |
Fixed when the settings tests were added (the tests now pass normally):
/api/llm/review also matched /api/llm/review-limits. Defenders may set them again (DEFENDER_POST)./api/llm/chat-es); it is now admin only, as ACCESS_CONTROL.md says.cfg_validate now rejects unknown device classes, bad sensitive/discovery/gateway ports and non-numeric scan thresholds (a text threshold crashed collection).Fixed when the Lateral movement, Network and Alerts tests were added:
/api/lateral?p=garbage answered 400 with “list index out of range”; it now says how a period is written.GET /api/alerts?cleared=1 listed suppressed alerts as cleared by a “(rule removed)” mute rule; the view now lists only mute-rule clears.GET /api/alerts?limit=abc and POST /api/alerts/mutes with a non-numeric id answered 500; they are now 400.Fixed when the Open events and Posture tests were added:
/api/events/open?limit=-1 returned every row but the last (past the 5000 cap) and limit=abc answered 500; a negative limit now means counts only and a non-number is a 400.Other things noticed while writing the tests (not failures):
NETMON_AUDIT_ES_KEY, and an audit form post that includes the key also resets a blank index to logs-syn./api/config/cfg is unreachable: bodies over 64 KB are refused with 413 first.test_e2e_settings.py points the audit log at a fake Elasticsearch on loopback instead of reading only the spool.index.html hard-codes style.css?v=…, which the build-hash stamping doesn’t replace.ipaddress treats the RFC 5737 ranges as private, so llm_providers._base_url accepts http:// to them.Generated by tests/gen_docs.py.
Every setting in tests/settings_inventory.py (kept in step with the code by tests/unit/test_settings_inventory.py) and the tests that verify it.
| Setting | Where | Endpoint | Requirements | Unit | E2E |
|---|---|---|---|---|---|
integrations.elasticsearch |
Configuration > Integrations > Elasticsearch (URL, API key, index names) | /api/config/integrations/elasticsearch |
SET-01, SET-02, SET-03, SET-04, SET-05, SET-06, SET-07, SET-12, SET-13, SET-60, SET-61, SET-62 | 28 | 10 |
integrations.unifi |
Configuration > Integrations > UniFi (controller URL, API key) | /api/config/integrations/unifi |
SET-01, SET-05, SET-06, SET-07, SET-08, SET-12, SET-13, SET-60, SET-61, SET-62 | 23 | 10 |
integrations.audit |
More > Audit log > Audit log storage (key, index, send event reviewer / researcher events) | /api/config/integrations/audit |
SET-05, SET-06, SET-09, SET-10, SET-11, SET-13, SET-14, SET-15, SET-63 | 22 | 1 |
integrations.web |
Configuration > Integrations > Web search (provider, Firecrawl URL, key, CA) | /api/config/integrations/web |
WEB-01, WEB-02, WEB-03, WEB-04, SET-60, SET-61 | 4 | 9 |
integrations.opencti |
Configuration > Integrations > OpenCTI | /api/config/integrations/opencti |
OCTI-01, OCTI-03, SET-60, SET-61 | 3 | 9 |
integrations.kubernetes |
Configuration > Integrations > Kubernetes API (URL(s), read-only token, CA, CIS on/off) | /api/config/integrations/kubernetes |
KUBE-05, KUBE-06, SET-60, SET-61 | 13 | 9 |
integrations.feeds |
Configuration > Integrations > Threat-intel feeds | /api/config/integrations/feeds |
FEED-01, FEED-02, SET-60 | 3 | 4 |
cfg.policy |
Settings > Network policy (zones, roles, device classes, ports, thresholds) | /api/config/cfg |
STO-02, SET-40, SET-41, SET-42, SET-43, SET-44, SET-45, SET-46, SET-47, SET-49, SET-50, SET-67 | 29 | 3 |
cfg.class_defs |
Settings > Network policy > Device class definitions (add, rename, remove, behaves like, per-class alarm switches) | /api/config/classes |
CLS-01, CLS-02, CLS-03, CLS-04, CLS-05, ANA-30 | 11 | 0 |
cfg.host_policy |
Settings > Host policy | /api/config/cfg |
STO-02, SET-40, SET-41, SET-42, SET-43, SET-48, SET-49 | 20 | 0 |
cfg.known_benign |
Settings > Known benign | /api/config/cfg |
STO-02, SET-40, SET-41, SET-42, SET-43, SET-48 | 18 | 0 |
cfg.site |
Settings > Site | /api/config/cfg |
STO-02, CFG-01, EVW-01, SET-40, SET-41, SET-42, SET-43, SET-48 | 41 | 2 |
cfg.class_scope |
Settings > Network policy > upload_spike / volume_spike / scan_thresholds / beacon: classes (device class drop-down) and by_class overrides | /api/config/cfg |
CLS-06, CLS-07, CLS-08, VOL-03, VOL-04 | 10 | 0 |
cfg.volume_spike |
Settings > Network policy > volume_spike: min_mb, times_normal, mad_factor, min_days, severity (volume-spike finding) | /api/config/cfg |
VOL-01, VOL-02, VOL-05 | 5 | 0 |
cfg.tune |
Settings > Auto-tune thresholds (recommend, accept) | /api/config/tune-apply |
SET-51, SET-52, SET-67, CLS-09, VOL-05 | 11 | 3 |
cfg.discover |
Settings > Network policy > Discover from UniFi | /api/config/discover |
SET-53, SET-54, SET-55 | 8 | 0 |
review.lookback |
More > Settings > Site > event_window_minutes: event window (correlation window, review coverage, settle wait) | /api/config/cfg |
EVW-01, EVW-02, EVW-03, EVW-04, SET-64 | 17 | 6 |
push.gate |
More > Settings > Site > push_wait_for_ai / push_hold_max_minutes: wait for the AI verdict before phone alerts, longest hold | /api/config/cfg |
PSH-01, PSH-05, PSH-06 | 6 | 0 |
users.trust |
More > Settings > Site > min_indicators / few_indicators_max_confidence / user_alert_min_confidence / stop_device_min_confidence / baseline_alerts_to_users: who is told what | /api/config/cfg |
ALR-30, ALR-31, ALR-32 | 5 | 0 |
review.schedule |
AI pipeline configuration > Review job schedule | /api/config/review-schedule |
CFG-01, SET-64 | 21 | 7 |
review.job |
AI pipeline configuration > Review job: on/off, event modes | /api/llm/review |
CFG-01, OPS-06, SET-64 | 32 | 7 |
research.limits |
AI pipeline configuration > Research job limits (model, cost caps, web) | /api/llm/research |
CFG-01, SET-64 | 21 | 7 |
autoclose |
Open events > Auto-close settings and guard rails | /api/config/triage, /api/config/triage/reopen |
STO-08, STO-12, SET-64 | 18 | 6 |
notes.consolidate |
AI pipeline configuration > Nightly note consolidation | /api/llm/notes-consolidate |
STO-09, SET-66 | 6 | 8 |
llm.models |
AI pipeline configuration > Models (event reviewer, research, chat model) | /api/llm/config |
SET-22, SET-23, SET-65 | 6 | 4 |
llm.providers |
AI pipeline configuration > AI providers (added APIs, local server) | /api/llm/providers |
SET-32, SET-33, SET-34, SET-65 | 8 | 4 |
llm.clef |
AI pipeline configuration > Decision model settings (on/off, thresholds) | /api/llm/clef |
SET-30, SET-31, SET-66 | 6 | 8 |
llm.clef_server |
AI pipeline configuration > Decision model server | /api/llm/clef-server |
SET-35 | 3 | 0 |
llm.notes |
AI pipeline configuration > Event reviewer context notes | /api/llm/notes |
SET-20, SET-21, SET-16, SET-66 | 7 | 8 |
llm.review_limits |
AI pipeline configuration > Review limits | /api/llm/review-limits |
STO-05, SET-26, SET-27, SET-28, SET-29, SET-66, SET-69 | 23 | 15 |
llm.esqueries |
AI pipeline configuration > Event reviewer look-ups: Elasticsearch | /api/llm/esqueries |
SET-25, SET-66 | 3 | 8 |
llm.websearch |
AI pipeline configuration > Event reviewer look-ups: web search | /api/llm/websearch |
SET-25, SET-66 | 3 | 8 |
llm.lookupplan |
AI pipeline configuration > Event reviewer look-ups first | /api/llm/lookupplan |
SET-24, SET-66 | 1 | 8 |
llm.es_writer |
AI pipeline configuration > Models: Search writer (planning review page; none = planner / reviewer) | /api/llm/config |
LLM-12, SET-66 | 7 | 8 |
llm.es_planner |
AI pipeline configuration > Models: Elasticsearch planner (none = the event reviewer plans) | /api/llm/config |
LLM-11, SET-66 | 7 | 8 |
llm.webcache |
AI pipeline configuration > Syn web cache (on/off, days kept, clear) | /api/llm/webcache |
WEB-08, SET-66 | 9 | 8 |
llm.chat_es |
Ask AI: may the chat search Elasticsearch | /api/llm/chat-es |
SET-23, SET-66, SET-69 | 2 | 15 |
push.prefs |
Account > Notifications (which devices alert me) | /api/push/prefs |
STO-07, SET-68 | 35 | 5 |
| File | Tests | Covers |
|---|---|---|
tests/unit/test_advice.py |
10 | Unit tests for dashboard/app/advice.py: the analyst’s advice for the device owner on each alert (a second verdict in (ALR-26, ALR-27, ALR-28, ALR-29, OE-21) |
tests/unit/test_aireview_paging.py |
2 | Unit tests for AI pipeline monitoring: the core request carries no verdict rows (no Decisions list on the page). (AIR-01) |
tests/unit/test_aiusage.py |
2 | Unit tests for dashboard/app/aiusage.py: hourly token totals behind AI pipeline monitoring > Tokens chart. (LLM-04) |
tests/unit/test_alerts_page.py |
34 | Unit tests for the Alerts page (#/alerts): the alert store’s mute / suppress / retention rules, the 15-minute watcher (ALR-02, ALR-05, ALR-06, ALR-07, ALR-08, ALR-09, ALR-10, ALR-11, ALR-12, ALR-13, ALR-14, ALR-15, ALR-16, ALR-17, ALR-18, ALR-19, ALR-20, ALR-21, ALR-22, ALR-23, ALR-24, ALR-25, CFG-05) |
tests/unit/test_alerts_view.py |
9 | Unit tests for the Alerts page helpers in dashboard/app/eventstore.py: verdicts, web research, artifact notes, detections. (FEAT-03, FEAT-04, FEAT-05, FEAT-06) |
tests/unit/test_analyze.py |
19 | Unit tests for the pure helpers of analyze.py (device keys, baseline records, deviation statistics). (ANA-01, ANA-30, RISK-03) |
tests/unit/test_audit.py |
48 | Unit tests for dashboard/app/audit.py: secret redaction, entry building, spooling while Elasticsearch is down. (AUD-01, AUD-02, AUD-03, AUD-05) |
tests/unit/test_auth.py |
44 | Unit tests for dashboard/app/auth.py: password hashing, user management, roles, sessions and sign-in throttling. (AC-02, AC-05, AC-07, AC-08, AUTH-01, AUTH-02, AUTH-03, AUTH-04, AUTH-05, AUTH-06, AUTH-07, AUTH-08, DASH-03, SEC-06) |
tests/unit/test_autoclose.py |
15 | Unit tests for dashboard/app/autoclose.py: AI-verdict auto-close of open events (Open events page, any type/age). (OE-20, STO-05, STO-08, STO-12) |
tests/unit/test_backclose.py |
1 | Back button / back gesture closes the open modal (static/backclose.js) - run under node with a tiny fake DOM + history. (UI-93) |
tests/unit/test_cardinfo_keys.py |
7 | Static checks: every top-level box title on the AI pipeline and Alerts pages has an info (ⓘ) text in cardinfo.js. (FEAT-10, FEAT-11) |
tests/unit/test_cert_dns_notes.py |
5 | Unit tests for DNS, TLS and IPs notes: TLS certificates are artifacts with notes, domain notes reach events about their (STO-13) |
tests/unit/test_class_scope.py |
11 | Device-class scope of the upload_spike / scan_thresholds / beacon rules (policy classes + by_class): config merge, (CLS-06, CLS-07, CLS-08, CLS-09) |
tests/unit/test_classdefs.py |
10 | Unit tests for device class definitions and per-class alarm switches (classdefs.py, Settings > Network policy > (CLS-01, CLS-02, CLS-03, CLS-04, CLS-05, UI-92) |
tests/unit/test_clef_apikey.py |
5 | Decision-model API key (clef.set_config api_key / clear_key): sent as a Bearer header on every request, never (LLM-03) |
tests/unit/test_clef_stage.py |
9 | Decision-model stage of the correlation review (clef.py + corr_llm.clef_pass / event_pass), against a fake (LLM-03) |
tests/unit/test_config.py |
35 | Unit tests for the config helpers: site_cfg.py, window.py, lookback.py, review_cfg.py, research_cfg.py. (AC-06, CFG-01, CFG-03, CFG-05, OPS-03, OPS-06, STO-01, STO-02) |
tests/unit/test_config_guard_js.py |
3 | config.js (Settings > Configuration > Auto-close) under node with a stubbed page: the guard rails save on every change (SET-64) |
tests/unit/test_corr_web.py |
12 | Unit tests for the event reviewer’s web look-ups (corr_llm.py): private-detail filter, cited-source checking, logging + overview. (WEB-07, WEB-08) |
tests/unit/test_correlate.py |
42 | Unit tests for dashboard/app/correlate.py: artifact extraction, stable ids, topics and the pair scoring in build(). (COR-01, COR-02, COR-03, COR-04, MIT-01, OCTI-10) |
tests/unit/test_es_planner.py |
7 | Unit tests for the dedicated Elasticsearch planner (AI pipeline configuration > Models): setting, the look-ups-first (LLM-11) |
tests/unit/test_es_query.py |
16 | Unit tests for the event reviewer’s richer Elasticsearch look-ups: es_context.build (any / exclude / range / prefix / (LLM-08, LLM-09, LLM-10) |
tests/unit/test_esq_review.py |
7 | Unit tests for the Elasticsearch planning review (admin page /esqreview): storage, validation of marks and own searches, (LLM-12) |
tests/unit/test_event_fires.py |
8 | Unit tests for eventstore firings: only events seen in Elasticsearch fire, overlapping report windows merge into one firing. (FEAT-01, FEAT-02) |
tests/unit/test_event_window.py |
20 | Event window (lookback.py): one setting for the correlation window, the review job’s coverage and the event (EVW-01, EVW-02, EVW-03, EVW-04, EVW-05, EVW-06, EVW-07, EVW-11, OPS-03) |
tests/unit/test_evtime.py |
14 | Event times from Elasticsearch (evtime.py): which records an event maps to, the stored first/last record times on (EVT-01, EVT-02, EVT-03) |
tests/unit/test_feeds_cfg.py |
12 | Configurable threat-intel feeds (extras.feed_list / apply_feed_config, integrations section ‘feeds’) and the (FEED-01, FEED-02, FEED-03, OCTI-02, OCTI-08, OCTI-09) |
tests/unit/test_gpustat.py |
2 | Unit tests for gpustat.py: GPU busy % per local model (AI pipeline monitoring > GPU use). (LLM-05) |
tests/unit/test_host_baseline_asof.py |
2 | hosts.as_of / first-seen minutes: a time range collected after the review job still reports the first-seen host (POS-21) |
tests/unit/test_host_garbled.py |
2 | Host telemetry: garbled host names (macOS agents report mojibake) are named from Fleet or dropped. (POS-21) |
tests/unit/test_ids_verdicts.py |
6 | Unit tests for the IDS events Verdict column: GET /api/verdicts (server.event_verdicts) and the tables that show it. (POS-22, POS-23) |
tests/unit/test_ioc_pivot.py |
13 | Unit tests for research -> indicator hunt: iocs.extract, es_context.hunt, corr_llm._ioc_pivot / researched artifacts. (WEB-09) (WEB-09) |
tests/unit/test_issues.py |
28 | Unit tests for dashboard/app/issues.py (per-snapshot Fix-list checks and cross-snapshot tracking). (CFG-05, ISS-01, ISS-02, OPS-05, OPS-06, RISK-03) |
tests/unit/test_issues_k8s_cis.py |
3 | (KUBE-06, KUBE-10) |
tests/unit/test_issues_race.py |
2 | Regression: the Fix list (fixlist.sync / issues._eval) runs in request threads and background jobs at once; the (OPS-05) |
tests/unit/test_k8s.py |
16 | Unit tests for k8s.py (Kubernetes security monitoring from Security Onion data). (KUBE-01, KUBE-02, KUBE-03, KUBE-04, KUBE-12) |
tests/unit/test_kb_expiry.py |
5 | Unused host notes expire after the configured number of days. (SET-16, STO-15) |
tests/unit/test_kb_pod.py |
5 | (KUBE-12) |
tests/unit/test_kube_api.py |
12 | Unit tests for the read-only Kubernetes API integration, the CIS benchmark and the map (kube_api / kube_cis / kube_map). (KUBE-05, KUBE-06, KUBE-07) |
tests/unit/test_kube_images.py |
6 | Kubernetes multi-cluster filter, events into Open events, and container image updates/CVEs (k8s.py, kube_images.py). (KUBE-08, KUBE-09, KUBE-10) |
tests/unit/test_lateral.py |
35 | Unit tests for dashboard/app/lateral.py (admin-session levels, lateral graph edges, multi-period merge). (LAT-01, LAT-02, RISK-04) |
tests/unit/test_lateral_page.py |
35 | Unit tests for the Lateral movement page: lateral.build() gaps (naming, gateways, scans, allow/cleared flows, internet hosts), server.lateral_periods() and lateral.js page logic under node. (LAT-02, LAT-20, LAT-21, LAT-22, LAT-23, LAT-24, LAT-25, LAT-26, LAT-27, LAT-28, LAT-29, LAT-31, LAT-32, LAT-33, LAT-34, LAT-35, LAT-36, LAT-37, LAT-38, LAT-39, LAT-40, POS-11, POS-16) |
tests/unit/test_llm_parsing.py |
32 | Unit tests for the network-free parsing helpers of corr_llm.py and llm_providers.py. (COR-03, LLM-01) |
tests/unit/test_login_lookups.py |
4 | Unit tests for the standard “who is on this system?” look-ups run with every review of an event about an internal system. (LLM-13) (LLM-13) |
tests/unit/test_mitre.py |
13 | Unit tests for mitre.py: rule matching, technique lookup, alert tags and catalog validation. (MIT-01) |
tests/unit/test_modelstatus.py |
3 | Unit tests for dashboard/app/modelstatus.py: AI pipeline monitoring > Models (each model role, its source, up/down). (COR-05) |
tests/unit/test_network_pages.py |
28 | Unit tests for Network -> Network map (#/netmap, netmap.js) and Network -> Traffic map (#/traffic, app.js V.traffic + (NET-01, NET-02, NET-03, NET-04, NET-05, NET-06, NET-07, NET-08, NET-09, NET-10, NET-11, NET-12, NET-13, NET-14, NET-15, NET-16, NET-17, NET-18, NET-19, NET-20, NET-21, NET-22, NET-23, NET-25) |
tests/unit/test_notes_consolidate.py |
11 | Unit tests for dashboard/app/notes_consolidate.py: nightly merge of AI-written host notes (AI pipeline monitoring > Host note consolidation). (COR-05, STO-09, STO-11) |
tests/unit/test_open_events.py |
49 | Open events page backend (eventstore: upsert, vuln lifecycle, grouping, filters, check-offs, display merges, extras, (OE-01, OE-02, OE-03, OE-04, OE-05, OE-06, OE-07, OE-08, OE-09, OE-10, OE-11, OE-12, OE-13, OE-14, OE-15, OE-16, OE-19) |
tests/unit/test_open_review_coverage.py |
3 | Every open event gets an event reviewer label, a Pending review badge or a ‘Not reviewed: |
tests/unit/test_opencti.py |
15 | Unit tests for the OpenCTI integration: integrations.py (opencti section) and opencti.py. (OCTI-01, OCTI-02, OCTI-03, OCTI-04, OCTI-05, OCTI-06, OCTI-07, OCTI-10) |
tests/unit/test_owner_verdict_scope.py |
10 | A person’s Expected / Benign verdict with chosen artifacts (scope): kb.py stores and matches it, corr_llm.apply_owner weighs it (STO-14) |
tests/unit/test_plain_alerts.py |
17 | Plain-language alerts for the User role (dashboard/app/plainmsg.py) and alarm lifetime in corr_llm.sync_alarms. (AC-09, AC-10, ALR-28, ALR-30, ALR-31, ALR-32, STO-06, STO-07, STO-08) |
tests/unit/test_posture.py |
29 | Unit tests for the data behind Security -> Posture (dashboard view ‘security’): snapshots, time ranges, suppress filters, cleared segmentation, check-offs and the app.js check-off logic. (POS-01, POS-02, POS-03, POS-04, POS-05, POS-06, POS-07, POS-08, POS-09, POS-10, POS-11, POS-12, POS-13, POS-14, POS-15, POS-16, POS-17, POS-18) |
tests/unit/test_push_gate.py |
11 | Phone-push gate (dashboard/app/pushgate.py): urgent alarms wait for the event reviewer’s group verdict, expected / (PSH-01, PSH-02, PSH-03, PSH-04, PSH-05, PSH-06) |
tests/unit/test_push_targeting.py |
38 | Unit tests for per-user alert targeting (store.py prefs/watch_ids/alert_targets) and Web Push fan-out (pushsvc.py). (AC-02, AC-06, AC-09, ALR-28, RISK-03, STO-06, STO-07) |
tests/unit/test_related_view.py |
1 | Open events page: related events of rows older than the loaded snapshot come from the stored verdicts (STO-10) |
tests/unit/test_repo_guard.py |
22 | Unit tests for repo_guard.py scan(): forbidden files, MAC addresses, site IPs and sensitive terms. (SEC-04) |
tests/unit/test_review_noai.py |
6 | Unit tests for the review / research split: review.py never researches, research.py runs only for a person’s click. (OPS-06) |
tests/unit/test_reviewer_output.py |
6 | Unit tests for the event reviewer’s one-paragraph output contract, the decision state’s kept count and the (FEAT-07, FEAT-09, REV-01) |
tests/unit/test_reviewlog.py |
7 | Review log (reviewlog.py) and the daily audit indices (audit.index_for) - no Elasticsearch needed. (AIR-02, AUD-04) |
tests/unit/test_risk.py |
40 | Unit tests for dashboard/app/risk.py (vulnerability and host risk scoring, zones, segmentation keys). (ISS-02, LAT-01, RISK-01, RISK-02, RISK-03, RISK-04) |
tests/unit/test_risk_k8s.py |
4 | Risk: Kubernetes workloads ranked with hosts (risk.k8s_rows). (KUBE-11) |
tests/unit/test_runarchive.py |
8 | Review-run documents are pipeline input only: run summaries (runarchive.py), pruning, the time-range-only page API (DASH-07, OPS-06, POS-01, POS-04) |
tests/unit/test_scheduler.py |
17 | Unit tests for the scheduler’s time/slot computations (scheduler.py, review_cfg.py); no jobs are started. (EVW-06, OPS-03) |
tests/unit/test_scoped_notes.py |
3 | Unit tests for dashboard/app/kb.py wider-scope internet notes: parent-domain notes cover subdomains, CIDR-range notes cover addresses. (STO-13) |
tests/unit/test_server_cache.py |
2 | Unit tests for the dashboard’s in-memory document cache (server.load_json). (DASH-02, OPS-05) |
tests/unit/test_settings_ai.py |
43 | Unit tests for every AI-pipeline setting: corr_llm setters (notes, models, look-ups, review limits), the decision-model (EVW-01, EVW-02, SET-20, SET-21, SET-22, SET-23, SET-24, SET-25, SET-26, SET-27, SET-28, SET-29, SET-30, SET-31, SET-32, SET-33, SET-34, SET-35) |
tests/unit/test_settings_integrations.py |
40 | Unit tests for the Integrations settings (integrations.py) sections elasticsearch, unifi and audit, plus the audit on/off switches end to end. (SET-01, SET-02, SET-03, SET-04, SET-05, SET-06, SET-07, SET-08, SET-09, SET-10, SET-11, SET-12, SET-13, SET-14, SET-15) |
tests/unit/test_settings_inventory.py |
5 | Settings coverage guard: every setting found in the code is in tests/settings_inventory.py and covered by a test. (SET-90) |
tests/unit/test_settings_site.py |
38 | Unit tests for the Settings page documents: settings_docs catalog vs templates, store cfg round trip, server.cfg_validate (ANA-30, SET-40, SET-41, SET-42, SET-43, SET-44, SET-45, SET-46, SET-47, SET-48, SET-49, SET-50, SET-51, SET-52, SET-53, SET-54, SET-55) |
tests/unit/test_settings_ui.py |
5 | Unit tests for small Settings / theme UI pieces: the learned host name in the device classes editor (settings.js (SET-71, UI-90, UI-91) |
tests/unit/test_signature_notes.py |
7 | Security > Event notes: kb.signature_notes groups people’s event notes by IDS signature, kb.update_event_note edits them. (STO-17) |
tests/unit/test_static_assets.py |
15 | Static checks of dashboard/app/static: referenced assets exist and app.js fnv() matches correlate.fnv (no node needed). (CFG-06, COR-02, DASH-01, DASH-06) |
tests/unit/test_store.py |
67 | Unit tests for store.py: docs, cfg, acks, mutes, suppress rules, alerts, push, findings, registry, history, ops. (AC-06, DASH-05, OPS-04, RISK-04, SEC-06, STO-01, STO-02, STO-03, STO-04, STO-05, STO-06, STO-07) |
tests/unit/test_stream.py |
7 | Event stream (stream.py + streamchecks.py): Suricata / syslog / host alerts tailed every few seconds by arrival time, (EVW-09, EVW-10) |
tests/unit/test_syn_flash.py |
4 | Syn’s distilled models: syn-correlation-flash as the decision model (OpenAI-compatible chat, one A/B token, p(yes) (LLM-06, LLM-07) |
tests/unit/test_ti_trend.py |
1 | Threat-intel trend endpoint: built one snapshot at a time (never all snapshots in memory). (DASH-07) |
tests/unit/test_training_page.py |
2 | /training: the model-training status page is admin-only. (AC-11) |
tests/unit/test_unifi_cache.py |
5 | Unit tests for the UniFi pre-warm cache (unifi.py): it lives in netmon.db (unifi_rows/unifi_streams + docs unifi/*), (SEC-06, STO-16) |
tests/unit/test_verdict_ti_override.py |
6 | A person’s Expected / Benign verdict stops a recurring alert: whole-domain scope (dns:*. |
tests/unit/test_volume_spike.py |
7 | volume-spike thresholds in the policy (Settings > Network policy > volume_spike): defaults equal the former hardcoded (VOL-01, VOL-02, VOL-03, VOL-04, VOL-05) |
tests/unit/test_vulnhist.py |
4 | vulnhist.py: daily vulnerability counts (Fix list, CIS, image CVEs) and the series the line charts read. (KUBE-13) |
tests/unit/test_websearch_audit.py |
2 | (AUD-06) |
tests/unit/test_webtools.py |
6 | Unit tests for the web search integration: integrations.py (web section) and webtools.py Firecrawl (cloud / self-hosted). (WEB-01, WEB-02, WEB-03, WEB-04, WEB-05, WEB-06) |
| File | Tests | Covers |
|---|---|---|
tests/e2e/test_e2e_access_control.py |
26 | E2E: role-based access control and the audit trail, exercised through the real server. (AC-02, AC-03, AC-04, AC-05, AC-06, AC-07, AC-08, AUD-01, AUD-02, AUD-03, AUTH-01, AUTH-02, AUTH-03, AUTH-04, CFG-01, DASH-01, DASH-05, LLM-03, SEC-06, STO-07) |
tests/e2e/test_e2e_alerts.py |
13 | E2E: the Alerts page API (#/alerts) through the real server - the feed and its query parameters, read markers, the (ALR-01, ALR-02, ALR-03, ALR-04, ALR-05, ALR-06, ALR-07, ALR-08, ALR-09, ALR-20) |
tests/e2e/test_e2e_container.py |
5 | E2E (deployed): read-only checks of the RUNNING netmon-dashboard container. (AC-01, DASH-04, OPS-02, SEC-01) |
tests/e2e/test_e2e_dashboard.py |
35 | E2E: the real dashboard server over HTTPS - transport, sign-in, sessions, pages, the JSON API and check-offs. (AC-01, AUTH-01, AUTH-02, AUTH-04, AUTH-05, COR-03, DASH-01, DASH-02, DASH-03, DASH-04, DASH-05, LLM-02, MIT-01, RISK-02, SEC-01, SEC-02, SEC-03, SEC-05, STO-01, STO-03, STO-06) |
tests/e2e/test_e2e_lateral.py |
6 | E2E: Network -> Lateral movement through the real server - GET /api/lateral for a seeded snapshot, roles, the p= period path (LAT-23, LAT-29, LAT-30, LAT-31) |
tests/e2e/test_e2e_network.py |
5 | E2E: the data behind Network -> Network map and Network -> Traffic map through the real server - snapshot internal (NET-03, NET-07, NET-08, NET-20, NET-22, NET-23, NET-24) |
tests/e2e/test_e2e_open_events.py |
10 | E2E: the Open events API of the real dashboard server - list, filters, limits, display merges, check-offs, the event (OE-03, OE-04, OE-05, OE-07, OE-09, OE-11, OE-12, OE-13, OE-14, OE-17, OE-18, OE-19) |
tests/e2e/test_e2e_pipeline.py |
16 | E2E: the batch pipeline and operator tooling, run as real processes against an isolated store. (AC-05, ANA-01, AUTH-01, AUTH-06, AUTH-07, DASH-02, LLM-02, OPS-01, OPS-03, OPS-04, RISK-02, RISK-03, SEC-04, STO-01) |
tests/e2e/test_e2e_posture.py |
13 | E2E: the data behind Security -> Posture through the real server - snapshots and time ranges, suppress rules, check-offs, roles. (POS-01, POS-02, POS-04, POS-05, POS-06, POS-07, POS-09, POS-10, POS-11, POS-12, POS-19, POS-20) |
tests/e2e/test_e2e_settings.py |
39 | E2E: every admin settings endpoint of the real dashboard server over HTTPS. (EVW-01, SET-60, SET-61, SET-62, SET-63, SET-64, SET-65, SET-66, SET-67, SET-68, SET-69, SET-70) |