mock

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEmails

func CheckEmails(t *testing.T, messages []*EmailMeta)

CheckEmails verifies that the provided email messages exist on the mock. This method should only be called from a test context and checks to make sure that the given emails were "sent".

func Reset

func Reset()

Tests that send emails should call Reset as part of their cleanup to ensure that other tests can depend on the state of the mock.

Types

type EmailLog added in v0.5.0

type EmailLog struct {
	sync.Mutex
	Data [][]byte
}

EmailLog combines email data with a mutex to ensure that tests can safely access the mock concurrently.

var Emails EmailLog

Emails contains all emails sent by the mock which tests can use to verify which emails were sent.

type EmailMeta

type EmailMeta struct {
	To          string
	From        string
	Subject     string
	Timestamp   time.Time
	Attachments int
}

EmailMeta makes it easier for tests to verify that the correct emails were sent without comparing the entire email body.

type SendGridClient

type SendGridClient struct {
	Storage string
}

func (*SendGridClient) Send

func (c *SendGridClient) Send(msg *sgmail.SGMailV3) (rep *rest.Response, err error)

Jump to

Keyboard shortcuts

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