105 route tests, matrix crawl, spec and README updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
23 lines
1.1 KiB
C++
23 lines
1.1 KiB
C++
// Route: GET/POST /tenancy/data (tenant-scoped data isolation, cap)
|
|
#include "support/Assert.hpp"
|
|
|
|
using namespace molo::example::test;
|
|
using molo::example::fw::Method;
|
|
|
|
int main() {
|
|
Fixture f;
|
|
auto add = f.client->request(Method::Post, "/tenancy/data", "item=alpha", {{"X-Tenant-ID", "acme"}});
|
|
check(add.status == 201, "add");
|
|
auto acme = f.client->request(Method::Get, "/tenancy/data", "", {{"X-Tenant-ID", "acme"}});
|
|
check(contains(acme.body, "alpha"), "visible to owner");
|
|
auto globex = f.client->request(Method::Get, "/tenancy/data", "", {{"X-Tenant-ID", "globex"}});
|
|
check(!contains(globex.body, "alpha"), "side effect: isolated from other tenant");
|
|
check(f.client->request(Method::Post, "/tenancy/data", "item=", {{"X-Tenant-ID", "acme"}}).status == 422, "empty item 422");
|
|
int last = 0;
|
|
for (int i = 0; i < 55; ++i)
|
|
last = f.client->request(Method::Post, "/tenancy/data", "item=x", {{"X-Tenant-ID", "acme"}}).status;
|
|
check(last == 429, "per-tenant cap 429");
|
|
check(f.client->get("/tenancy/data").status == 200, "default tenant GET");
|
|
return finish("tenancy/data");
|
|
}
|