test

package
v0.13.15 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBleveTestIndex

func CreateBleveTestIndex(testname string) (string, func())

CreateBleveTestIndex creates a bleve index name with the given testname and a function to remove the index.

func CreateSqliteTestDB

func CreateSqliteTestDB(name string) (*sqlx.DB, func(), error)

CreateSqliteTestDB creates an in memory sqlite database.

func EqualError

func EqualError(a, b error) bool

EqualError reports whether errors a and b are considered equal. They're equal if both are nil, or both are not nil and a.Error() == b.Error().

func InitDockerPool

func InitDockerPool(t *testing.T) *dockertest.Pool

Types

type Mail

type Mail struct {
	Email   string
	Subject string
	Body    string
}

type MailHogClient

type MailHogClient struct {
	URL string
}

func RunMailHog

func RunMailHog(t *testing.T, pool *dockertest.Pool) (string, MailHogClient)

func (MailHogClient) GetLastEmail

func (c MailHogClient) GetLastEmail() (MailHogMessage, error)

func (MailHogClient) V1GetMessages

func (m MailHogClient) V1GetMessages() ([]MailHogMessage, error)

func (MailHogClient) WantLastEmailToBe

func (c MailHogClient) WantLastEmailToBe(t *testing.T, from string, to string, subject string, body string)

type MailHogMessage

type MailHogMessage struct {
	ID   string
	From struct {
		Relays  string
		Mailbox string
		Domain  string
		Params  string
	}
	To []struct {
		Relays  string
		Mailbox string
		Domain  string
		Params  string
	}
	Content struct {
		Headers map[string][]string
		Body    string
		Size    int
		Mime    string
	}
	Created time.Time
	Mime    string
	Raw     struct {
		From string
		To   []string
		Data string
		Helo string
	}
}

type Mailer

type Mailer struct {
	Mails []Mail
}

func NewMailer

func NewMailer() *Mailer

func (*Mailer) Send

func (m *Mailer) Send(email, subject, body string) error

type Notification

type Notification struct {
	UserID  string
	Subject string
	Message string
	Link    notification.Link
}

type Notifier

type Notifier struct {
	Notifications []Notification
}

func NewNotifier

func NewNotifier() *Notifier

func (*Notifier) Notify

func (n *Notifier) Notify(ctx context.Context, userID string, subject string, message string, link notification.Link) error

type TestQueue

type TestQueue struct {
	// contains filtered or unexported fields
}

func NewTestQueue

func NewTestQueue() *TestQueue

func (*TestQueue) AddOperation

func (q *TestQueue) AddOperation(op oqueue.Operation) error

func (*TestQueue) AddSubscriber

func (q *TestQueue) AddSubscriber(consume oqueue.OperationConsumer, worker int)

func (*TestQueue) Close

func (q *TestQueue) Close()

func (*TestQueue) WasCalled

func (q *TestQueue) WasCalled(t *testing.T, op oqueue.Operation)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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