Files

19 lines
784 B
C++
Raw Permalink Normal View History

// Route: GET /audit/mask (masking and redaction patterns)
#include "support/Assert.hpp"
using namespace molo::example::test;
using molo::example::fw::Method;
int main() {
Fixture f;
auto d = f.client->get("/audit/mask");
check(d.status == 200 && contains(d.body, "a***********@example.com"), "email masked");
check(contains(d.body, "************1111"), "card keeps last 4");
check(contains(d.body, "[EMAIL]") && contains(d.body, "[SSN]") && contains(d.body, "[IP]"), "redactions");
check(contains(d.body, "\"redactions\":4"), "counted 4 hits");
auto c = f.client->get("/audit/mask?text=nothing+here");
check(contains(c.body, "\"redactions\":0"), "clean text unchanged");
check(f.client->post("/audit/mask").status == 405, "405");
return finish("audit/mask");
}