Documentation ¶
Overview ¶
Package mock provides intermediary data structures to assist in testing and debugging sending an email without actually sending the email - testing the creation and sending of email typically requires some kind of tracking of what was sent or not and metadata about the message which is what is setup here
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckEmails ¶
func CheckEmails(t *testing.T, messages []*EmailMetadata)
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" (not actually sent hehe)
func ResetEmailMock ¶
func ResetEmailMock()
ResetEmailMock tests that send emails should call ResetEmailMock as part of their cleanup to ensure that other tests can depend on the state of the mock
Types ¶
type EmailLog ¶
EmailLog combines email data with a mutex to ensure that tests can safely access the mock concurrently for that email blastertons
var Emails EmailLog
Emails contains all emails sent by the mock which tests can use to verify which emails were sent
type EmailMetadata ¶
type EmailMetadata struct { To string From string Subject string Timestamp time.Time Attachments int }
EmailMetadata makes it easier for tests to verify that the correct emails were sent without comparing the entire email body since that's 'spensive
type SendGridClient ¶
type SendGridClient struct {
Storage string
}
SendGridClient is the duct tape method which allows for local storage output