// Route: GET /google/enterprise/status #include #include "support/GoogleRig.hpp" using namespace molo::example::test; int main() { setenv("GOOGLE_CLOUD_PROJECT", "test-project", 1); { GoogleRig rig(false); Fixture f(rig.client); auto res = f.client->get("/google/enterprise/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, "discoveryengine.googleapis.com") && contains(res.body, "ces.googleapis.com") && contains(res.body, "recommendationengine.googleapis.com"), "services listed"); check(contains(res.body, "project=test-project"), "activation url uses the project"); check(contains(res.body, "\"max_list_items\":500"), "caps shown"); check(rig.mock->send_count() == 0, "side effect: no upstream traffic"); } { GoogleRig rig; Fixture f(rig.client); auto res = f.client->get("/google/enterprise/status"); check(contains(res.body, "\"configured\":true"), "configured with a credential"); check(!contains(res.body, kTestKey), "credential never shown"); check(f.client->post("/google/enterprise/status").status == 405, "post is 405"); } return finish("google/enterprise/status"); }