MCPcopy Create free account
hub / github.com/Exorust/Adkit-MCP / TestPolicySensitiveGating

Class TestPolicySensitiveGating

tests/test_policy_engine.py:40–60  ·  view source on GitHub ↗

Sensitive: default deny, allow when sensitive_ok.

Source from the content-addressed store, hash-verified

38
39
40class TestPolicySensitiveGating:
41 """Sensitive: default deny, allow when sensitive_ok."""
42
43 def test_sensitive_filtered_by_default(self):
44 engine = PolicyEngine()
45 hits = [_make_hit("ad-ok", 0.9), _make_hit("ad-sens", 0.8, sensitive=True)]
46 constraints = MatchConstraints()
47 placement = PlacementContext()
48 result = engine.apply(hits, constraints, placement)
49 ids = [h.ad_id for h in result]
50 assert "ad-ok" in ids
51 assert "ad-sens" not in ids
52
53 def test_sensitive_allowed_when_opted_in(self):
54 engine = PolicyEngine()
55 hits = [_make_hit("ad-sens", 0.8, sensitive=True)]
56 constraints = MatchConstraints(sensitive_ok=True)
57 placement = PlacementContext()
58 result = engine.apply(hits, constraints, placement)
59 assert len(result) == 1
60 assert result[0].ad_id == "ad-sens"
61
62
63class TestPolicyAgeRestrictedGating:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected