// Routes: POST /agent/registry/deny-policies/list, POST /agent/registry/boundaries/bindings #include "agent/registry/cases.hpp" using namespace molo::example::test; int main() { check_google_post_route("/agent/registry/deny-policies/list", "{\"project_number\":\"123456\"}", "{\"project_number\":\"my-project\"}", "non numeric project number"); check_google_post_route("/agent/registry/boundaries/bindings", "{\"org_id\":\"42\",\"id\":\"pab-1\"}", "{\"org_id\":\"42\",\"id\":\"a/b\"}", "bad policy id"); { GoogleRig rig; Fixture f(rig.client); check(f.client->post("/agent/registry/deny-policies/list", "{}", "application/json").status == 422, "limit: a missing project number is 422"); check(f.client->post("/agent/registry/deny-policies/list", "{\"project_number\":\"" + std::string(21, '1') + "\"}", "application/json") .status == 422, "limit: 21 digits is 422"); check(f.client->post("/agent/registry/boundaries/bindings", "{\"org_id\":\"x\",\"id\":\"pab-1\"}", "application/json").status == 422, "boundary bindings: bad org id is 422"); check(rig.mock->send_count() == 0, "side effect: rejected before any upstream call"); } return finish("agent/registry/iam"); }