// Route: POST /agent/registry/identity/principal (local builder, no credential needed) #include "support/GoogleRig.hpp" #include using namespace molo::example::test; using molo::example::fw::Method; int main() { const std::string json = "application/json"; GoogleRig rig(false); Fixture f(rig.client); auto res = f.client->post("/agent/registry/identity/principal", "{\"org_id\":\"123\",\"project_number\":\"456\",\"agent\":\"engine-1\"}", json); check(res.status == 200, "status 200 without a credential"); check(contains(res.body, "principal://agents.global.org-123.system.id.goog/aiplatform/engine-1"), "principal built"); check(contains(res.body, "attribute.platformContainer/aiplatform/projects/456"), "project set built"); check(contains(res.body, "attribute.platform/aiplatform"), "org set built"); check(f.client->post("/agent/registry/identity/principal", "{\"org_id\":\"12x\"}", json).status == 422, "non numeric org is 422"); check(f.client->post("/agent/registry/identity/principal", "{\"org_id\":\"1\",\"agent\":\"a/b\"}", json).status == 422, "bad agent name is 422"); check(f.client->get("/agent/registry/identity/principal").status == 405, "get is 405"); check(rig.mock->send_count() == 0, "side effect: no upstream traffic"); return finish("agent/registry/identity/principal"); }