Files
moloapp/tests/example/ai/meta/page_test.cpp
T

32 lines
1.5 KiB
C++

// Routes: GET /ai/meta, /ai/meta/status, /ai/meta/calls (no credential, no upstream)
#include "support/Assert.hpp"
using namespace molo::example::test;
int main() {
Fixture f;
auto page = f.client->get("/ai/meta");
check(page.status == 200, "page 200");
check(contains(page.headers.get("Content-Type"), "text/html"), "page is html");
check(contains(page.body, "Meta Model API") && contains(page.body, "/embedded/ai_meta.js"),
"page names the product and loads its script");
auto status = f.client->get("/ai/meta/status");
check(status.status == 200, "status 200");
check(contains(status.headers.get("Content-Type"), "application/json"), "status is json");
check(contains(status.body, "https://api.meta.ai/v1"), "base url shown");
check(contains(status.body, "muse-spark-1.3") && contains(status.body, "sam-3.1"), "models listed");
check(contains(status.body, "\"hosted\":false"), "open-weight models flagged as self-hosted");
check(!contains(status.body, "LLM_"), "no credential material shown");
auto calls = f.client->get("/ai/meta/calls");
check(calls.status == 200 && contains(calls.body, "/responses/{response_id}/cancel") &&
contains(calls.body, "/asr/realtime"),
"call table listed");
check(f.client->post("/ai/meta").status == 405, "post to page is 405");
check(f.client->post("/ai/meta/status").status == 405, "post to status is 405");
check(f.client->get("/ai/meta/responses").status == 405, "get on a vendor route is 405");
return finish("ai/meta/page");
}