Files
moloapp/tests/example/audit/verify_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

19 lines
915 B
C++

// Route: GET /audit/verify + POST /audit/tamper (tamper detection)
#include "support/Assert.hpp"
using namespace molo::example::test;
using molo::example::fw::Method;
int main() {
Fixture f;
auto v = f.client->get("/audit/verify");
check(v.status == 200 && contains(v.body, "\"intact\":true") && contains(v.body, "\"first_broken\":null"), "intact");
check(f.client->post("/audit/tamper", "index=abc").status == 422, "bad index");
check(f.client->post("/audit/tamper", "index=99").status == 404, "missing record");
check(f.client->post("/audit/tamper", "index=1").status == 200, "tamper");
auto b = f.client->get("/audit/verify");
check(contains(b.body, "\"intact\":false") && contains(b.body, "\"first_broken\":1"), "first broken index reported");
check(contains(f.client->get("/audit/log").body, "Chain broken at index 1"), "side effect: page shows break");
return finish("audit/verify");
}