Files
moloapp/tests/example/crypto/random_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

16 lines
723 B
C++

// Route: GET /crypto/random (urandom token, 1 to 64 bytes)
#include "support/Assert.hpp"
using namespace molo::example::test;
int main() {
Fixture f;
auto a = f.client->get("/crypto/random?bytes=8");
auto b = f.client->get("/crypto/random?bytes=8");
check(a.status == 200 && contains(a.body, "\"bytes\":8"), "8 bytes ok");
check(a.body != b.body, "tokens differ");
check(f.client->get("/crypto/random").status == 200, "default ok");
check(f.client->get("/crypto/random?bytes=65").status == 400, "over cap 400");
check(f.client->get("/crypto/random?bytes=abc").status == 400, "non numeric 400");
check(f.client->post("/crypto/random", "x").status == 405, "POST 405");
return finish("crypto/random");
}