emailtest

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SenderMock

type SenderMock struct {
	// SendFunc mocks the Send method.
	SendFunc func(from string, to []string, msg []byte) error
	// contains filtered or unexported fields
}

SenderMock is a mock implementation of email.Sender.

    func TestSomethingThatUsesSender(t *testing.T) {

        // make and configure a mocked email.Sender
        mockedSender := &SenderMock{
            SendFunc: func(from string, to []string, msg []byte) error {
	               panic("mock out the Send method")
            },
        }

        // use mockedSender in code that requires email.Sender
        // and then make assertions.

    }

func (*SenderMock) Send

func (mock *SenderMock) Send(from string, to []string, msg []byte) error

Send calls SendFunc.

func (*SenderMock) SendCalls

func (mock *SenderMock) SendCalls() []struct {
	From string
	To   []string
	Msg  []byte
}

SendCalls gets all the calls that were made to Send. Check the length with:

len(mockedSender.SendCalls())

Jump to

Keyboard shortcuts

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