// Route: GET /agent/registry/status #include "support/GoogleRig.hpp" #include 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"); }