Files
moloapp/tests/example/tenancy/config_test.cpp
T
retoorandClaude Sonnet 5.5 62fdd08da8 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>
2026-10-24 02:19:52 +02:00

18 lines
1.0 KiB
C++

// Route: GET/POST /tenancy/config (config overlay)
#include "support/Assert.hpp"
using namespace molo::example::test;
using molo::example::fw::Method;
int main() {
Fixture f;
Method P = Method::Post;
check(contains(f.client->get("/tenancy/config").body, "\"theme\":\"light\""), "base value");
check(f.client->request(P, "/tenancy/config", "key=theme&value=dark", {{"X-Tenant-ID", "acme"}}).status == 200, "set overlay");
check(contains(f.client->request(Method::Get, "/tenancy/config", "", {{"X-Tenant-ID", "acme"}}).body, "\"theme\":\"dark\""), "overlay wins");
check(contains(f.client->request(Method::Get, "/tenancy/config", "", {{"X-Tenant-ID", "globex"}}).body, "\"theme\":\"light\""), "side effect: other tenant keeps base");
check(f.client->request(P, "/tenancy/config", "key=bogus&value=x", {{"X-Tenant-ID", "acme"}}).status == 422, "unknown key");
check(f.client->request(P, "/tenancy/config", "key=theme&value=", {{"X-Tenant-ID", "acme"}}).status == 422, "empty value");
return finish("tenancy/config");
}