Geräte-STT (Web Speech API) entfernt — auf Android nur Cloud, Qualität < Whisper, verwirrend. STT läuft jetzt überall serverseitig (Whisper). Geräte-TTS bleibt. - Backend: allow_cloud_stt (config/runtime_config/api me) + Tests entfernt. - Frontend: SpeechRecognition-Code, STT-Dropdown, "Lokal"-Button raus. Menü-Redesign (verständlicher + passt auf Handys): - Kopfzeile schlank: Mund-Icon + Titel + Sprache + ⋮-Menübutton (kein Überlauf mehr). - ⋮ öffnet ein Einstellungs-Sheet: Ton als 3 Presets (📱 Im Gerät / ☁ Server / ✨ Beste Qualität) statt zweier kryptischer "Gerät"-Dropdowns; Neues Gespräch; Tag-/Nachtmodus; Konto (Identität, Admin, Abmelden). - #tts bleibt als verborgenes Quell-Select -> bestehende TTS-Logik unverändert. - Doku §5.1.2 neu, §6.3 STT-Hinweis. 167 grün. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
"""Tests für das Audit-Logging der Admin-Aktionen."""
|
|
|
|
import logging
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
from app.main import app
|
|
from app.config import settings
|
|
from app.runtime_config import invalidate_cache
|
|
|
|
client = TestClient(app)
|
|
ADMIN = "test-admin-key"
|
|
ADM_HDR = {"X-Admin-Key": ADMIN}
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _setup(monkeypatch):
|
|
monkeypatch.setattr(settings, "admin_api_key", ADMIN)
|
|
monkeypatch.setattr(settings, "auth_enabled", False)
|
|
invalidate_cache()
|
|
yield
|
|
invalidate_cache()
|
|
|
|
|
|
def test_config_set_is_audited(caplog):
|
|
with caplog.at_level(logging.INFO, logger="va.audit"):
|
|
r = client.put("/api/admin/config/local_llm_top_p",
|
|
json={"value": "0.7"}, headers=ADM_HDR)
|
|
assert r.status_code == 200
|
|
line = "\n".join(caplog.messages)
|
|
assert "action=config_set" in line
|
|
assert "local_llm_top_p" in line
|
|
assert "user=admin-key" in line
|
|
# aufräumen
|
|
client.delete("/api/admin/config/local_llm_top_p", headers=ADM_HDR)
|
|
|
|
|
|
def test_backend_switch_rejection_is_audited(caplog):
|
|
with caplog.at_level(logging.INFO, logger="va.audit"):
|
|
r = client.post("/api/admin/llm/backend",
|
|
json={"backend": "boese"}, headers=ADM_HDR)
|
|
assert r.status_code == 422
|
|
assert "action=llm_backend_switch_rejected" in "\n".join(caplog.messages)
|
|
|
|
|