Documentation
¶
Index ¶
- type LoggerMock
- type SMTPClientMock
- func (mock *SMTPClientMock) Auth(auth smtp.Auth) error
- func (mock *SMTPClientMock) AuthCalls() []struct{ ... }
- func (mock *SMTPClientMock) Close() error
- func (mock *SMTPClientMock) CloseCalls() []struct{}
- func (mock *SMTPClientMock) Data() (io.WriteCloser, error)
- func (mock *SMTPClientMock) DataCalls() []struct{}
- func (mock *SMTPClientMock) Mail(from string) error
- func (mock *SMTPClientMock) MailCalls() []struct{ ... }
- func (mock *SMTPClientMock) Quit() error
- func (mock *SMTPClientMock) QuitCalls() []struct{}
- func (mock *SMTPClientMock) Rcpt(to string) error
- func (mock *SMTPClientMock) RcptCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoggerMock ¶
type LoggerMock struct { // LogfFunc mocks the Logf method. LogfFunc func(format string, args ...interface{}) // contains filtered or unexported fields }
LoggerMock is a mock implementation of notify.Logger.
func TestSomethingThatUsesLogger(t *testing.T) { // make and configure a mocked notify.Logger mockedLogger := &LoggerMock{ LogfFunc: func(format string, args ...interface{}) { panic("mock out the Logf method") }, } // use mockedLogger in code that requires notify.Logger // and then make assertions. }
func (*LoggerMock) Logf ¶
func (mock *LoggerMock) Logf(format string, args ...interface{})
Logf calls LogfFunc.
func (*LoggerMock) LogfCalls ¶
func (mock *LoggerMock) LogfCalls() []struct { Format string Args []interface{} }
LogfCalls gets all the calls that were made to Logf. Check the length with:
len(mockedLogger.LogfCalls())
type SMTPClientMock ¶
type SMTPClientMock struct { // AuthFunc mocks the Auth method. AuthFunc func(auth smtp.Auth) error // CloseFunc mocks the Close method. CloseFunc func() error // DataFunc mocks the Data method. DataFunc func() (io.WriteCloser, error) // MailFunc mocks the Mail method. MailFunc func(from string) error // QuitFunc mocks the Quit method. QuitFunc func() error // RcptFunc mocks the Rcpt method. RcptFunc func(to string) error // contains filtered or unexported fields }
SMTPClientMock is a mock implementation of notify.SMTPClient.
func TestSomethingThatUsesSMTPClient(t *testing.T) { // make and configure a mocked notify.SMTPClient mockedSMTPClient := &SMTPClientMock{ AuthFunc: func(auth smtp.Auth) error { panic("mock out the Auth method") }, CloseFunc: func() error { panic("mock out the Close method") }, DataFunc: func() (io.WriteCloser, error) { panic("mock out the Data method") }, MailFunc: func(from string) error { panic("mock out the Mail method") }, QuitFunc: func() error { panic("mock out the Quit method") }, RcptFunc: func(to string) error { panic("mock out the Rcpt method") }, } // use mockedSMTPClient in code that requires notify.SMTPClient // and then make assertions. }
func (*SMTPClientMock) Auth ¶
func (mock *SMTPClientMock) Auth(auth smtp.Auth) error
Auth calls AuthFunc.
func (*SMTPClientMock) AuthCalls ¶
func (mock *SMTPClientMock) AuthCalls() []struct { Auth smtp.Auth }
AuthCalls gets all the calls that were made to Auth. Check the length with:
len(mockedSMTPClient.AuthCalls())
func (*SMTPClientMock) CloseCalls ¶
func (mock *SMTPClientMock) CloseCalls() []struct { }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedSMTPClient.CloseCalls())
func (*SMTPClientMock) Data ¶
func (mock *SMTPClientMock) Data() (io.WriteCloser, error)
Data calls DataFunc.
func (*SMTPClientMock) DataCalls ¶
func (mock *SMTPClientMock) DataCalls() []struct { }
DataCalls gets all the calls that were made to Data. Check the length with:
len(mockedSMTPClient.DataCalls())
func (*SMTPClientMock) Mail ¶
func (mock *SMTPClientMock) Mail(from string) error
Mail calls MailFunc.
func (*SMTPClientMock) MailCalls ¶
func (mock *SMTPClientMock) MailCalls() []struct { From string }
MailCalls gets all the calls that were made to Mail. Check the length with:
len(mockedSMTPClient.MailCalls())
func (*SMTPClientMock) QuitCalls ¶
func (mock *SMTPClientMock) QuitCalls() []struct { }
QuitCalls gets all the calls that were made to Quit. Check the length with:
len(mockedSMTPClient.QuitCalls())
func (*SMTPClientMock) Rcpt ¶
func (mock *SMTPClientMock) Rcpt(to string) error
Rcpt calls RcptFunc.
func (*SMTPClientMock) RcptCalls ¶
func (mock *SMTPClientMock) RcptCalls() []struct { To string }
RcptCalls gets all the calls that were made to Rcpt. Check the length with:
len(mockedSMTPClient.RcptCalls())