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.
22 lines
880 B
C++
22 lines
880 B
C++
// Route: /forms/contact (form render plus validation)
|
|
#include "support/Assert.hpp"
|
|
|
|
using namespace molo::example::test;
|
|
|
|
int main() {
|
|
Fixture f;
|
|
auto form = f.client->get("/forms/contact");
|
|
check(form.status == 200, "form renders 200");
|
|
check(contains(form.body, "<form"), "form markup present");
|
|
auto ok = f.client->post("/forms/contact",
|
|
"name=ada&email=ada@x.io&message=hi",
|
|
"application/x-www-form-urlencoded");
|
|
check(ok.status == 200, "valid post is 200");
|
|
check(contains(ok.body, "Thanks ada"), "success page names user");
|
|
auto bad = f.client->post("/forms/contact", "name=ada",
|
|
"application/x-www-form-urlencoded");
|
|
check(bad.status == 422, "invalid post is 422");
|
|
check(contains(bad.body, "validation_error"), "failures listed");
|
|
return finish("forms/contact");
|
|
}
|