mailslurper

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMailslurperImageName specifies the Mailslurper docker image name to use in tests.
	DefaultMailslurperImageName = "oryd/mailslurper"
	// DefaultMailslurperEnvVarImageName is the environment variable name for default Mailslurper docker image name.
	DefaultMailslurperEnvVarImageName = "TEST_ORY_MAILSLURPER_IMAGE_NAME"
	// DefaultMailslurperImageVersion specifies the Mailslurper docker image version to use in tests.
	DefaultMailslurperImageVersion = "smtps-latest"
	// DefaultMailslurperEnvVarImageVersion is the environment variable name for default Mailslurper docker image version.
	DefaultMailslurperEnvVarImageVersion = "TEST_ORY_MAILSLURPER_IMAGE_VERSION"
	// DefaultSubjectRecoverAccount is used when retrieving account recovery email
	DefaultSubjectRecoverAccount = "Recover access to your account"
	// DefaultSubjectVerifyAccount is used when retrieving account verification email
	DefaultSubjectVerifyAccount = "Please verify your email address"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Mail

type Mail struct {
	MailItems    []*MailItem `json:"mailItems"`
	TotalPages   int         `json:"totalPages"`
	TotalRecords int         `json:"totalRecords"`
}

Mail represents mailslurper messages.

type MailItem

type MailItem struct {
	ID                string        `json:"id"`
	DateSent          string        `json:"dateSent"`
	FromAddress       string        `json:"fromAddress"`
	ToAddresses       []string      `json:"toAddresses"`
	Subject           string        `json:"subject"`
	XMailer           string        `json:"xmailer"`
	MIMEVersion       string        `json:"mimeVersion"`
	Body              string        `json:"body"`
	ContentType       string        `json:"contentType"`
	Boundary          string        `json:"boundary"`
	Attachments       []interface{} `json:"attachments"`
	TransferEncoding  string        `json:"transferEncoding"`
	Message           interface{}   `json:"Message,omitempty"`
	InlineAttachments interface{}   `json:"InlineAttachments,omitempty"`
	TextBody          string        `json:"TextBody"`
	HTMLBody          string        `json:"HTMLBody"`
}

MailItem represents a single mailslurper message.

type TestEnvContext

type TestEnvContext interface {
	Cleanup()
	ContainerIP() string
	ContainerWWWPort() string
	ContainerServicePort() string
	ContainerSMTPPort() string

	ExtractRecoveryLink(*MailItem) (string, error)
	ExtractVerificationLink(*MailItem) (string, error)
	ListEmail() (*Mail, error)
	WaitForRecoveryEmail(context.Context, *testing.T, string) <-chan interface{}
	WaitForVerificationEmail(context.Context, *testing.T, string) <-chan interface{}
	WaitForEmailWithSubject(context.Context, *testing.T, string, string) <-chan interface{}
}

TestEnvContext represents a test Mailslurper environment context.

func SetupTestMailslurper

func SetupTestMailslurper(t *testing.T) TestEnvContext

SetupTestMailslurper sets up Mailslurper environment for tests. This environment can be passed to other Ory components in tests.

Jump to

Keyboard shortcuts

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