Files
moloapp/tests/example/ai/openrouter/status_test.cpp
T

22 lines
1.1 KiB
C++
Raw Normal View History

// Routes: GET /ai/openrouter/status and /ai/openrouter/calls
#include "support/Assert.hpp"
using namespace molo::example::test;
int main() {
Fixture f;
auto res = f.client->get("/ai/openrouter/status");
check(res.status == 200, "status 200");
check(contains(res.body, "\"configured\":false"), "reports no API key");
check(contains(res.body, "\"management_configured\":false"), "reports no management key");
check(contains(res.body, "OPENROUTER_MANAGEMENT_KEY"), "names the management key variable");
check(contains(res.body, "\"calls\":140"), "reports the call count");
auto calls = f.client->get("/ai/openrouter/calls");
check(calls.status == 200, "calls 200");
check(contains(calls.body, "sendChatCompletionRequest") && contains(calls.body, "/chat/completions"), "table lists chat");
check(contains(calls.body, "\"key\":\"mgmt\""), "table lists management calls");
check(f.client->post("/ai/openrouter/status", "{}", "application/json").status == 405, "post is 405");
check(f.client->post("/ai/openrouter/calls", "{}", "application/json").status == 405, "calls post is 405");
return finish("ai/openrouter/status");
}