2026-10-24 04:36:42 +02:00
|
|
|
// Routes: GET /agent/sessions (page), GET /agent/sessions/status
|
|
|
|
|
#include "support/GoogleRig.hpp"
|
|
|
|
|
|
|
|
|
|
using namespace molo::example::test;
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
{
|
|
|
|
|
GoogleRig rig;
|
|
|
|
|
Fixture f(rig.client);
|
|
|
|
|
auto page = f.client->get("/agent/sessions");
|
|
|
|
|
check(page.status == 200, "page 200");
|
|
|
|
|
check(contains(page.headers.get("Content-Type"), "text/html"), "html");
|
|
|
|
|
check(contains(page.body, "Agent sessions and memory"), "heading");
|
|
|
|
|
check(contains(page.body, "/agent/sessions/memories/purge"), "lists the purge route");
|
2026-10-24 05:43:13 +02:00
|
|
|
check(contains(page.body, "/agent/sessions/operations/wait"), "lists the server-side wait route");
|
|
|
|
|
check(contains(page.body, "/agent/sessions/serving-profiles/list"), "lists serving profiles");
|
2026-10-24 04:36:42 +02:00
|
|
|
check(contains(page.body, "viewport"), "mobile viewport meta from the base template");
|
|
|
|
|
|
|
|
|
|
auto status = f.client->get("/agent/sessions/status");
|
|
|
|
|
check(status.status == 200, "status 200");
|
|
|
|
|
check(contains(status.headers.get("Content-Type"), "application/json"), "status is json");
|
|
|
|
|
check(contains(status.body, "\"configured\":true"), "configured with a credential");
|
|
|
|
|
check(contains(status.body, "aiplatform v1beta1"), "names the API surface");
|
|
|
|
|
check(contains(status.body, "\"max_top_k\":50"), "shows the top_k cap");
|
2026-10-24 05:43:13 +02:00
|
|
|
check(contains(status.body, "\"max_server_wait_seconds\":60"), "shows the wait cap");
|
2026-10-24 04:36:42 +02:00
|
|
|
check(!contains(status.body, kTestKey), "credential never shown");
|
|
|
|
|
check(rig.mock->send_count() == 0, "side effect: GET pages never call Google");
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
GoogleRig rig(false);
|
|
|
|
|
Fixture f(rig.client);
|
|
|
|
|
check(contains(f.client->get("/agent/sessions/status").body, "\"configured\":false"),
|
|
|
|
|
"not configured without a credential");
|
|
|
|
|
check(f.client->get("/agent/sessions").status == 200, "page works without a credential");
|
|
|
|
|
}
|
|
|
|
|
Fixture f;
|
|
|
|
|
check(f.client->post("/agent/sessions").status == 405, "post on the page is 405");
|
|
|
|
|
check(f.client->post("/agent/sessions/status").status == 405, "post on status is 405");
|
|
|
|
|
return finish("agent/sessions page");
|
|
|
|
|
}
|