Testing Guide
How to test Highflame Shield integrations — monitor mode for non-blocking tests, test fixtures, signal assertions, debug/explain flags, and session tracking verification.
Testing Strategies
Approach
Use when
Using Monitor Mode in Tests
import pytest
from highflame import Highflame, GuardRequest
@pytest.fixture
def client():
return Highflame(api_key="hf_sk_test_...")
def test_guardrail_observes_prompt(client):
resp = client.guard.evaluate(GuardRequest(
content="What is the capital of France?",
content_type="prompt",
action="process_prompt",
mode="monitor", # Always allows, captures decision
))
assert resp.decision == "allow"
# actual_decision shows what would have been enforced
# assert resp.actual_decision in ("allow", "deny")Testing with a Test API Key
Testing Enforcement Behavior
Testing Signal Detection
Testing Shield Decorators (Python)
Testing TypeScript Applications
Testing Session Tracking
Inspecting Debug Information
Using the Debug Resource
Last updated