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 ¶
- type Message
- type Outbox
- func (o *Outbox) Email() config.EmailSender
- func (o *Outbox) Last(t testing.TB, kind iam.MessageKind, to string) Message
- func (o *Outbox) Messages(kind iam.MessageKind, to string) []Message
- func (o *Outbox) SMS() config.SMSSender
- func (o *Outbox) SetEmailHealth(err error)
- func (o *Outbox) SetSMSHealth(err error)
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 ¶
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) SetEmailHealth ¶ added in v0.149.0
SetEmailHealth sets what the email sender's CheckHealth returns; nil, the default, is healthy.
func (*Outbox) SetSMSHealth ¶ added in v0.149.0
SetSMSHealth is SetEmailHealth for the SMS sender.