Mercurial
view dictation/server_test.py @ 279:b3b547563ec7
Add Google connector service and agent wiki
Implement the C/Seobeo Google Drive and Gmail connector with encrypted OAuth storage, Zenbu authentication, browser testing, AI tool discovery, chunked HTTP decoding, and Bazel coverage. Consolidate repository guidance into progressive wiki documentation and enforce arena-first allocation for new first-party C code.
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 84c338fd-0939-4bb3-b7f3-1062eb213e5d
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Mon, 17 Aug 2026 22:22:36 -0700 |
| parents | 78699f810817 |
| children | 49e9e591c9bb |
line wrap: on
line source
from pathlib import Path import unittest from fastapi.testclient import TestClient from dictation.config import DictationConfig from dictation.server import create_app from dictation.transcriber import Transcript class FakeTranscriber: async def warmup(self): return None async def transcribe(self, samples, *, final): return Transcript("test transcript", "en", 0.99) def test_config() -> DictationConfig: return DictationConfig( host="127.0.0.1", port=8090, model_dir=Path("/tmp/model"), compute_type="int8_float16", max_sessions=1, partial_interval_ms=1200, silence_ms=700, max_utterance_seconds=30, speech_threshold=0.012, ) class ServerTest(unittest.TestCase): def test_health_and_assets(self): with TestClient(create_app(test_config(), FakeTranscriber())) as client: health = client.get("/health") self.assertEqual(health.status_code, 200) self.assertEqual(health.json()["status"], "ok") self.assertIn("Zenbu Dictation", client.get("/").text) self.assertIn("RTCPeerConnection", client.get("/dictation.js").text) def test_rejects_non_offer_sdp(self): with TestClient(create_app(test_config(), FakeTranscriber())) as client: response = client.post( "/api/webrtc/offer", json={"sdp": "not-sdp", "type": "answer"}, ) self.assertEqual(response.status_code, 422) def test_close_is_idempotent(self): with TestClient(create_app(test_config(), FakeTranscriber())) as client: response = client.post( "/api/webrtc/session/00000000-0000-0000-0000-000000000000/close" ) self.assertEqual(response.status_code, 200) self.assertEqual(response.json(), {"closed": True}) if __name__ == "__main__": unittest.main()