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,24 @@
|
||||
// Route: GET /tenancy/resolve (tenant from header, subdomain, default)
|
||||
#include "support/Assert.hpp"
|
||||
|
||||
using namespace molo::example::test;
|
||||
using molo::example::fw::Method;
|
||||
|
||||
int main() {
|
||||
Fixture f;
|
||||
auto def = f.client->get("/tenancy/resolve");
|
||||
check(def.status == 200 && contains(def.body, "\"source\":\"default\""), "default tenant");
|
||||
check(contains(def.headers.get("Content-Type"), "application/json"), "json type");
|
||||
auto hdr = f.client->request(Method::Get, "/tenancy/resolve", "", {{"X-Tenant-ID", "acme"}});
|
||||
check(contains(hdr.body, "\"tenant\":\"acme\"") && contains(hdr.body, "header"), "header wins");
|
||||
auto sub = f.client->request(Method::Get, "/tenancy/resolve", "", {{"Host", "globex.example.com"}});
|
||||
check(contains(sub.body, "subdomain") && contains(sub.body, "globex"), "subdomain");
|
||||
auto bad = f.client->request(Method::Get, "/tenancy/resolve", "", {{"X-Tenant-ID", "Bad_ID"}});
|
||||
check(bad.status == 400 && contains(bad.headers.get("Content-Type"), "problem+json"), "malformed id is 400 problem");
|
||||
auto none = f.client->request(Method::Get, "/tenancy/resolve", "", {{"X-Tenant-ID", "nobody"}});
|
||||
check(none.status == 404, "unknown tenant 404");
|
||||
check(f.client->post("/tenancy/resolve").status == 405, "405 on post");
|
||||
auto m = f.client->get("/tenancy/metrics");
|
||||
check(contains(m.body, "\"resolve\""), "side effect: metric counted");
|
||||
return finish("tenancy/resolve");
|
||||
}
|
||||
Reference in New Issue
Block a user