86-row call table checked against Google discovery documents, typed services, local approval ledger, live read-only tests, /agent/registry demo. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
30 lines
1.1 KiB
C++
30 lines
1.1 KiB
C++
// Route: GET /agent/registry/status
|
|
#include "support/GoogleRig.hpp"
|
|
#include <cstdlib>
|
|
|
|
using namespace molo::example::test;
|
|
using molo::example::fw::Method;
|
|
|
|
int main() {
|
|
setenv("GOOGLE_CLOUD_PROJECT", "test-project", 1);
|
|
{
|
|
GoogleRig rig(false);
|
|
Fixture f(rig.client);
|
|
auto res = f.client->get("/agent/registry/status");
|
|
check(res.status == 200, "status 200 without a credential");
|
|
check(contains(res.headers.get("Content-Type"), "application/json"), "json");
|
|
check(contains(res.body, "\"configured\":false") && contains(res.body, "\"project_set\":true"), "state shown");
|
|
check(contains(res.body, "\"max_ledger_entries\":5000"), "caps shown");
|
|
check(rig.mock->send_count() == 0, "side effect: no upstream traffic");
|
|
}
|
|
{
|
|
GoogleRig rig;
|
|
Fixture f(rig.client);
|
|
auto res = f.client->get("/agent/registry/status");
|
|
check(contains(res.body, "\"configured\":true"), "configured with a credential");
|
|
check(!contains(res.body, kTestKey), "credential never shown");
|
|
check(f.client->post("/agent/registry/status").status == 405, "post is 405");
|
|
}
|
|
return finish("agent/registry/status");
|
|
}
|