Versions in this module Expand all Collapse all v0 v0.1.1 Nov 12, 2026 v0.1.0 Oct 14, 2026 Changes in this version + const BaseURL + const DefaultUserName + const MaxFaultSteps + const SQLiteDriver + var ErrFault = errors.New("authtest: injected database fault") + func DSNConnector(d driver.Driver, dsn string) driver.Connector + func SweepFaults[E any](t SweepT, fresh func() (E, *Faults), ...) + type Browser struct + Origin string + func (b *Browser) Client() *http.Client + func (b *Browser) Cookie(name string) *http.Cookie + func (b *Browser) Do(req *http.Request) *Response + func (b *Browser) Get(path string) *Response + func (b *Browser) Post(path string, body any) *Response + func (b *Browser) SetSession(s *Session) + func (b *Browser) URL() string + type Clock struct + func NewClock() *Clock + func (c *Clock) Advance(d time.Duration) + func (c *Clock) Now() time.Time + func (c *Clock) Set(t time.Time) + type Env struct + Auth *auth.Auth + BaseURL string + Clock *Clock + DB *sql.DB + Dialect sqlb.Dialect + Faults *Faults + Mail *Mailbox + SMS *SMSBox + T testing.TB + func New(t testing.TB, opts ...Option) *Env + func (e *Env) Anonymous(ctx context.Context) context.Context + func (e *Env) Browser(h http.Handler) *Browser + func (e *Env) CreateUser(name string, ids ...Identity) auth.User + func (e *Env) DeleteUser(id string) + func (e *Env) NewUser(name string, ids ...Identity) UserFixture + func (e *Env) SaveUser(f UserFixture) auth.User + func (e *Env) SignIn(userID string) *Session + type Faults struct + func NewFaults() *Faults + func (f *Faults) Arm(at int) + func (f *Faults) Connector(base driver.Connector) driver.Connector + func (f *Faults) Disarm() bool + type Identity struct + Kind auth.IdentifierKindName + Value string + type Mailbox struct + func (m *Mailbox) Last(addr string) (email.Mail, bool) + func (m *Mailbox) LastCode(addr string) string + func (m *Mailbox) LastLink(addr string) *url.URL + func (m *Mailbox) LastToken(addr string) auth.Token + func (m *Mailbox) Reset() + func (m *Mailbox) Send(_ context.Context, mail email.Mail) error + func (m *Mailbox) Sent() []email.Mail + func (m *Mailbox) To(addr string) []email.Mail + type Option func(*settings) + func WithBaseURL(u string) Option + func WithDB(db *sql.DB, d sqlb.Dialect) Option + func WithFaults(f *Faults) Option + func WithOptions(opts ...auth.Option) Option + func WithPlugins(fn func(e *Env) []auth.Plugin) Option + func WithSQLite(driver, dsn string) Option + type Response struct + Body []byte + Header http.Header + Method string + Path string + Status int + func (r *Response) Decode(v any) + func (r *Response) ErrorCode() string + func (r *Response) Expect(want int) *Response + type SMSBox struct + func (s *SMSBox) LastCode(number string) string + func (s *SMSBox) Reset() + func (s *SMSBox) Send(_ context.Context, number, text string) error + func (s *SMSBox) To(number string) []string + type Session struct + Session auth.Session + Token auth.Token + func (s *Session) Apply(req *http.Request) + func (s *Session) ApplyBearer(req *http.Request) + func (s *Session) Authorization() string + func (s *Session) BearerContext(ctx context.Context) context.Context + func (s *Session) Context(ctx context.Context) context.Context + func (s *Session) Cookie() *http.Cookie + type SweepT interface + Errorf func(format string, args ...any) + Fatalf func(format string, args ...any) + Helper func() + Logf func(format string, args ...any) + type UserFixture struct + CreatedAt time.Time + ID string + Identities []Identity + Image string + Name string