Documentation
¶
Overview ¶
Package authtest implements the shared contract tests for enrollment authorizer implementations, the databases' impl/dbtest pattern: an implementation has at least one test that runs this suite. Recorder is the authorizer the seam's callers test with.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Recorder ¶
type Recorder struct {
// Asked holds the facts of every ask, in order.
Asked []enrollauth.AdmissionFacts
// Verdict is the answer every ask receives.
Verdict enrollauth.AdmissionVerdict
}
Recorder is an authorizer that records the facts it is asked with and answers every ask with its verdict.
func (*Recorder) Authorize ¶
func (r *Recorder) Authorize( _ context.Context, f enrollauth.AdmissionFacts) enrollauth.AdmissionAnswer
Authorize records the facts and answers the verdict.
type Suite ¶
type Suite struct {
// New builds the authorizer under test.
New func(t *testing.T) enrollauth.AdmissionAuthorizer
// Facts builds the facts the implementation cannot decide — a request
// carrying no address for the CIDR authorizer, a prompt the Telegram
// one cannot send — the fail-closed rule's input.
Facts func(t *testing.T) enrollauth.AdmissionFacts
}
Suite describes one implementation's run of the contract tests.