// 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, "

Models

"), "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"); }