Files
retoorandClaude Sonnet 5.5 6b731643bf feat(clients): models: Gemini on Vertex, Model Garden, Claude, endpoint models, media, VertexModel
One call table verified against Discovery (29 calls), live-verified read-only
with an express key and a service account token, /agent/models example routes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 04:40:00 +02:00

46 lines
2.0 KiB
C++

// Route: GET /agent/models (page, status and the declared call table; no credential needed)
#include "support/GoogleRig.hpp"
using namespace molo::example::test;
int main() {
{
Fixture f;
auto page = f.client->get("/agent/models");
check(page.status == 200, "page 200 without a credential");
check(contains(page.headers.get("Content-Type"), "text/html"), "html");
check(contains(page.body, "/embedded/agent_models.js"), "script referenced");
check(contains(page.body, "viewport") || contains(page.body, "<h1>Models</h1>"),
"page rendered");
check(contains(f.client->get("/").body, "/agent/models"), "matrix row present");
check(f.client->post("/agent/models").status == 405, "post on the page is 405");
}
{
GoogleRig none(false);
Fixture f(none.client);
auto st = f.client->get("/agent/models/status");
check(st.status == 200 && contains(st.body, "\"configured\":false"), "status: not configured");
check(contains(st.body, "\"mode\":\"express\""), "status: express mode without a project");
check(f.client->post("/agent/models/status").status == 405, "status post is 405");
check(none.mock->send_count() == 0, "side effect: no upstream traffic");
}
{
GoogleRig rig;
Fixture f(rig.client);
check(contains(f.client->get("/agent/models/status").body, "\"configured\":true"),
"status: configured with a key");
check(!contains(f.client->get("/agent/models/status").body, kTestKey), "credential never shown");
}
{
Fixture f;
auto calls = f.client->get("/agent/models/calls");
check(calls.status == 200, "calls 200");
check(contains(calls.body, "\"id\":\"gemini.generate\"") &&
contains(calls.body, "aiplatform.projects.locations.publishers.models.rawPredict") &&
contains(calls.body, "\"id\":\"media.predict_long_running\""),
"declared calls listed");
check(f.client->post("/agent/models/calls").status == 405, "calls post is 405");
}
return finish("agent/models/page");
}