Files
moloapp/tests/example/agent/runtime/list_test.cpp
T

20 lines
1.1 KiB
C++
Raw Normal View History

// Route: POST /agent/runtime/list
#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->post("/agent/runtime/list", "{}", "application/json");
check(res.status == 503 && contains(res.body, "google_not_configured"), "no credential is 503");
check(f.client->post("/agent/runtime/list", "not json", "application/json").status == 422, "bad json is 422");
check(f.client->post("/agent/runtime/list", "{\"filter\":5}", "application/json").status == 422, "non-string filter is 422");
check(f.client->post("/agent/runtime/list", "{\"filter\":\"" + std::string(600, 'f') + "\"}", "application/json").status == 422, "filter over cap is 422");
check(f.client->post("/agent/runtime/list", std::string(300 * 1024, 'a'), "application/json").status == 413, "body over cap is 413");
check(f.client->get("/agent/runtime/list").status == 405, "get is 405");
check(rig.mock->send_count() == 0, "nothing reached Google");
return finish("agent/runtime/list");
}