Skip to content

Testing helpers

testing

Explicitly non-production helpers for examples and host tests.

FixedClock

FixedClock(current: datetime)

A deterministic, manually adjustable clock.

now

now() -> datetime

advance

advance(delta: timedelta) -> None

SequentialIdentifiers

SequentialIdentifiers(*, start: int = 0)

Predictable identifiers for assertions; never use them in production.

new

new(prefix: str) -> str

RecordingEventSink

RecordingEventSink()

Capture minimized runtime events in emission order.

events instance-attribute

events: list[RuntimeEvent] = []

emit async

emit(event: RuntimeEvent) -> None

EphemeralProtection

EphemeralProtection(*, acknowledge_data_loss: bool)

Process-local test protection that loses all data on restart.

This helper provides real keyed commitments and keeps canonical payloads out of stored records, but it is not encryption, durable key custody, rotation, recovery, or a production protection service.

create async

create(*, proposal_reference: str, canonical_payload: bytes) -> KeyedCommitment

verify async

verify(*, proposal_reference: str, canonical_payload: bytes, commitment: KeyedCommitment) -> bool

destroy_commitment async

destroy_commitment(*, commitment: KeyedCommitment) -> None

protect async

protect(*, proposal_reference: str, canonical_payload: bytes) -> ProtectedPayload

unprotect async

unprotect(*, payload: ProtectedPayload) -> bytes

destroy_payload async

destroy_payload(*, payload: ProtectedPayload) -> None