testoutbox

package
v0.147.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 7 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, 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(_ context.Context, m iam.EmailMessage) error

Email delivers into o: wire it as Deps.Email.

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(_ context.Context, m iam.SMSMessage) error

SMS delivers into o: wire it as Deps.SMS.

Jump to

Keyboard shortcuts

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