// Route: GET /google/enterprise/calls (the call table) #include "support/GoogleRig.hpp" using namespace molo::example::test; int main() { GoogleRig rig(false); Fixture f(rig.client); auto res = f.client->get("/google/enterprise/calls?api=discoveryengine&q=servingConfigs.search"); check(res.status == 200, "200 without a credential"); check(contains(res.body, "servingConfigs.search") && contains(res.body, "v1/{+servingConfig}:search"), "rows shown"); check(contains(res.body, "\"truncated\":false"), "not truncated"); auto all = f.client->get("/google/enterprise/calls?api=dialogflow-es"); check(contains(all.body, "\"truncated\":true") && contains(all.body, "\"cap_items\":200"), "truncation is loud"); check(f.client->get("/google/enterprise/calls?api=nope").status == 422, "unknown api is 422"); check(f.client->get("/google/enterprise/calls?api=ces&q=" + std::string(101, 'a')).status == 422, "q cap"); check(f.client->post("/google/enterprise/calls").status == 405, "post is 405"); check(rig.mock->send_count() == 0, "side effect: no upstream traffic"); return finish("google/enterprise/calls"); }