25 lines
1.3 KiB
C++
25 lines
1.3 KiB
C++
// Routes: GET /ai/anthropic/admin, /status, /calls (no credential needed)
|
|||
|
|
#include "support/Assert.hpp"
|
||
|
|
|
||
|
|
using namespace molo::example::test;
|
||
|
|
|
||
|
|
int main() {
|
||
|
|
Fixture f;
|
||
|
|
auto page = f.client->get("/ai/anthropic/admin");
|
||
|
|
check(page.status == 200, "page is 200");
|
||
|
|
check(contains(page.headers.get("Content-Type"), "text/html"), "html");
|
||
|
|
check(contains(page.body, "Anthropic admin") && contains(page.body, "viewport"), "title and mobile viewport");
|
||
|
|
check(contains(page.body, "/embedded/ai_anthropic_admin.js"), "script wired");
|
||
|
|
check(f.client->post("/ai/anthropic/admin", "{}", "application/json").status == 405, "post is 405");
|
||
|
|
|
||
|
|
auto st = f.client->get("/ai/anthropic/admin/status");
|
||
|
|
check(st.status == 200 && contains(st.body, "\"admin_key\"") && contains(st.body, "\"api_version\""), "status lists the lanes");
|
||
|
|
check(!contains(st.body, "sk-ant"), "status never shows a key");
|
||
|
|
check(f.client->post("/ai/anthropic/admin/status", "{}", "application/json").status == 405, "status post is 405");
|
||
|
|
|
||
|
|
auto calls = f.client->get("/ai/anthropic/admin/calls");
|
||
|
|
check(calls.status == 200 && contains(calls.body, "organization.invites.create") &&
|
||
|
|
contains(calls.body, "usage_report.retrieve_messages"), "call table is listed");
|
||
|
|
return finish("ai/anthropic/admin/page");
|
||
|
|
}
|