feat(workflow): example covers security, platform, enterprise and resilience features
105 route tests, matrix crawl, spec and README updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// Route: GET/POST /tenancy/provision (HTML form, inline errors)
|
||||
#include "support/Assert.hpp"
|
||||
|
||||
using namespace molo::example::test;
|
||||
using molo::example::fw::Method;
|
||||
|
||||
int main() {
|
||||
Fixture f;
|
||||
auto page = f.client->get("/tenancy/provision");
|
||||
check(page.status == 200 && contains(page.headers.get("Content-Type"), "text/html"), "form page");
|
||||
auto bad = f.client->post("/tenancy/provision", "id=Bad&name=&plan=gold", "application/x-www-form-urlencoded");
|
||||
check(bad.status == 422 && contains(bad.headers.get("Content-Type"), "text/html"), "html 422");
|
||||
check(contains(bad.body, "field-error") && !contains(bad.body, "\"failures\""), "inline errors, no raw json");
|
||||
auto ok = f.client->post("/tenancy/provision", "id=initech&name=Initech&plan=pro", "application/x-www-form-urlencoded");
|
||||
check(ok.status == 201 && contains(ok.body, "provisioned"), "created");
|
||||
check(f.client->get("/tenancy/t/initech/whoami").status == 200, "side effect: tenant resolves");
|
||||
auto dup = f.client->post("/tenancy/provision", "id=initech&name=X&plan=free", "application/x-www-form-urlencoded");
|
||||
check(dup.status == 422 && contains(dup.body, "exists"), "duplicate rejected");
|
||||
auto js = f.client->request(Method::Post, "/tenancy/provision", "{\"id\":\"b\"}", {{"Content-Type", "application/json"}});
|
||||
check(js.status == 422 && contains(js.headers.get("Content-Type"), "application/json"), "json client gets json");
|
||||
return finish("tenancy/provision");
|
||||
}
|
||||
Reference in New Issue
Block a user