network-monitor/tests/conftest.py
neil 54a765510a Network monitor: hub, probes, Docker and native installers
Hub (FastAPI + no-build web UI):
- Network health: live probe/target matrix, status strips, incidents
- Probes: add (with install command), rename, remove, latency and throughput charts
- Clients merged from AdGuard, DHCP, query log and probe ARP tables; names,
  categories, suspicious flag, notes, per-client DNS requests
- Query log, domain detail (clients, related subdomains), blocked domains via
  the AdGuard Home /control API

Probe: tests peers (ping, HTTP, throughput), gateway, LAN and public DNS,
internet URLs and an optional VPS; buffers results while the hub is down.
Gateway and ARP from /proc/net on Linux, route/arp on macOS.

Install: install.sh (hub) and install-probe.sh (generated from it), each in
docker mode (compose; default on Linux hosts) or native mode (venv + systemd
or launchd; default on macOS and in LXC). Both modes deploy with an update
command that checks the new commit and rolls back on failure.

CLAUDE.md carries shared context for Claude Code sessions on each machine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 18:10:29 -08:00

20 lines
580 B
Python

import pytest
from fastapi.testclient import TestClient
@pytest.fixture(autouse=True)
def isolated(tmp_path, monkeypatch):
monkeypatch.setenv("DATA_DIR", str(tmp_path))
for k in ("ADGUARD_URL", "ADGUARD_USERNAME", "ADGUARD_PASSWORD", "UI_PASSWORD", "VPS_URL", "ROLE"):
monkeypatch.delenv(k, raising=False)
from app.hub import adguard
adguard._stats_cache.update(at=0.0, data=None)
monkeypatch.setattr(adguard, "TRANSPORT", None)
yield
@pytest.fixture
def hub():
from app.hub.server import app
with TestClient(app) as c:
yield c