Files
moloapp/tests/example/ai/audio/status_test.cpp
T
retoorandClaude Sonnet 5.5 6d80dd0223 feat(clients): audio: ElevenLabs, AssemblyAI, Deepgram, Cartesia, Speechmatics, Hume
Table driven REST (509 rows verified against vendor specs by tools/check_spec.py),
WebSockets over the src/google/live client, neutral SpeechSynthesizer /
SpeechRecognizer seam, /ai/audio demo with dry runs, 110 package tests and 5
route tests. PlayHT has no public API; LeMUR is gone from AssemblyAI's spec.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 15:36:57 +01:00

36 lines
2.0 KiB
C++

// Routes: GET /ai/audio/status and /ai/audio/calls
#include <cstdlib>
#include "support/Assert.hpp"
using namespace molo::example::test;
int main() {
for (const char* k : {"ELEVENLABS_API_KEY", "ASSEMBLYAI_API_KEY", "DEEPGRAM_API_KEY", "CARTESIA_API_KEY",
"SPEECHMATICS_API_KEY", "SPEECHMATICS_MANAGEMENT_TOKEN", "HUME_API_KEY"})
unsetenv(k);
Fixture f;
auto res = f.client->get("/ai/audio/status");
check(res.status == 200, "status 200");
check(contains(res.body, "\"name\":\"elevenlabs\"") && contains(res.body, "\"name\":\"hume\""), "lists the providers");
check(contains(res.body, "\"key_configured\":false"), "reports no keys");
check(contains(res.body, "ELEVENLABS_API_KEY") && contains(res.body, "SPEECHMATICS_MANAGEMENT_TOKEN"), "names the variables");
check(contains(res.body, "\"calls_total\":509"), "counts the calls");
check(contains(res.body, "playht") && contains(res.body, "do not resolve"), "says why PlayHT is absent");
check(!contains(res.body, "Bearer"), "no credential in the body");
setenv("DEEPGRAM_API_KEY", "dg-test-key", 1);
Fixture g;
auto on = g.client->get("/ai/audio/status");
check(contains(on.body, "\"key_configured\":true"), "reports a configured key");
check(!contains(on.body, "dg-test-key"), "never echoes the key");
unsetenv("DEEPGRAM_API_KEY");
auto calls = f.client->get("/ai/audio/calls?provider=deepgram");
check(calls.status == 200, "calls 200");
check(contains(calls.body, "/v1/listen") && contains(calls.body, "\"provider\":\"deepgram\""), "lists the deepgram table");
check(!contains(calls.body, "elevenlabs"), "filters by provider");
check(contains(f.client->get("/ai/audio/calls?provider=elevenlabs").body, "/v1/text-to-speech/{voice_id}"), "elevenlabs rows");
check(f.client->post("/ai/audio/status", "{}", "application/json").status == 405, "status post is 405");
check(f.client->post("/ai/audio/calls", "{}", "application/json").status == 405, "calls post is 405");
return finish("ai/audio/status");
}