testoutbox

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package testoutbox defines the capturing email and SMS senders that authtest publishes as authtest.Outbox. It depends only on iam and config, so AuthKit's engine tests use it too.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Channel  string                  `json:"channel"` // "email" or "sms"
	Kind     iam.MessageKind         `json:"kind"`
	To       string                  `json:"to"`
	Language string                  `json:"language"`
	Purpose  iam.VerificationPurpose `json:"purpose,omitempty"`
	Code     string                  `json:"code,omitempty"`
	Link     string                  `json:"link,omitempty"`
	// Token is the "token" parameter of Link's fragment (or query).
	Token         string               `json:"token,omitempty"`
	ContactChange *iam.ContactChange   `json:"contact_change,omitempty"`
	DeviceKey     *iam.DeviceKeyNotice `json:"device_key,omitempty"`
	At            time.Time            `json:"at"`
}

Message is one email or SMS AuthKit asked the host to deliver.

type Outbox

type Outbox struct {
	// contains filtered or unexported fields
}

Outbox records every message in order; it is safe for concurrent use. The zero value is ready: wire Email() and SMS() as Deps.Email and Deps.SMS.

func (*Outbox) Email

func (o *Outbox) Email() config.EmailSender

Email is o as Deps.Email: it delivers into o, and its CheckHealth returns what SetEmailHealth set.

func (*Outbox) Last

func (o *Outbox) Last(t testing.TB, kind iam.MessageKind, to string) Message

Last returns the newest message of kind sent to to (an empty to matches any recipient). The test fails when there is none.

func (*Outbox) Messages

func (o *Outbox) Messages(kind iam.MessageKind, to string) []Message

Messages returns the messages of kind sent to to, oldest first; an empty kind or to matches any.

func (*Outbox) SMS

func (o *Outbox) SMS() config.SMSSender

SMS is Email for Deps.SMS and SetSMSHealth.

func (*Outbox) SetEmailHealth added in v0.149.0

func (o *Outbox) SetEmailHealth(err error)

SetEmailHealth sets what the email sender's CheckHealth returns; nil, the default, is healthy.

func (*Outbox) SetSMSHealth added in v0.149.0

func (o *Outbox) SetSMSHealth(err error)

SetSMSHealth is SetEmailHealth for the SMS sender.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL