Files
moloapp/tests/example/validate/user_test.cpp
T
retoor 3c4334cec9 feat: implement MoloApp plans 01-15 with integration
Full C++23 framework tree: runtime, observability, security,
data, app, realtime, supervisor, clients, CLI, example plus
enterprise tenancy, audit, operability, governance,
supplychain. Postgres via docker compose for tests.
2026-10-23 18:20:04 +02:00

22 lines
792 B
C++

// Route: POST /validate/user (all-failures validation error)
#include "support/Assert.hpp"
using namespace molo::example::test;
int main() {
Fixture f;
auto ok = f.client->post(
"/validate/user",
"{\"username\":\"ada\",\"email\":\"ada@x.io\",\"age\":\"36\"}",
"application/json");
check(ok.status == 200, "valid model is 200");
auto bad = f.client->post("/validate/user",
"{\"username\":\"ad\",\"age\":\"old\"}",
"application/json");
check(bad.status == 422, "invalid model is 422");
check(contains(bad.body, "username"), "username failure listed");
check(contains(bad.body, "email"), "missing email listed");
check(contains(bad.body, "age"), "bad age listed");
return finish("validate/user");
}