Akteursbezogenes KI- und Butler-Aktivitätsprotokoll #44

Merged
sascha merged 3 commits from feature/butler-ai-activity-log into main 2026-08-16 21:40:41 +02:00
Showing only changes of commit 6620384dc4 - Show all commits

View file

@ -266,6 +266,39 @@ def test_audit_persists_and_redacts_secrets(tmp_path, monkeypatch):
assert entry["detail"].count("[REDACTED]") == 3 assert entry["detail"].count("[REDACTED]") == 3
def test_audit_records_ai_and_web_ui_actor(tmp_path, monkeypatch):
db = tmp_path / "audit.sqlite3"
monkeypatch.setattr(app, "AUDIT_DB_PATH", str(db))
async def empty_status():
return {}
monkeypatch.setattr(app, "_collect_service_status", empty_status)
app._ui_sessions.clear()
with TestClient(app.app) as client:
ai = client.get(
"/status",
headers={"Authorization": "Bearer test-token", "X-Butler-Actor": "Trulla"},
)
assert ai.status_code == 200
client.headers.pop("Authorization", None)
client.get("/ui/session")
web = client.get("/status")
assert web.status_code == 200
entries = client.get("/audit").json()
assert [item["actor"] for item in entries[:2]] == ["Weboberfläche", "Trulla"]
def test_ui_audit_has_actor_column_and_filter():
with TestClient(app.app) as client:
response = client.get("/ui")
assert '<th>Akteur</th>' in response.text
assert 'id="audit-actor"' in response.text
def test_wireguard_status_returns_redacted_live_state(monkeypatch): def test_wireguard_status_returns_redacted_live_state(monkeypatch):
payload = { payload = {
"interface": "wg0", "interface": "wg0",