105 route tests, matrix crawl, spec and README updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
18 lines
1.0 KiB
C++
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");
|
|
}
|