mocks

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddrMock added in v1.4.0

type AddrMock struct {
	S string
}

func (AddrMock) Network added in v1.4.0

func (a AddrMock) Network() string

func (AddrMock) String added in v1.4.0

func (a AddrMock) String() string

type ConnMock added in v1.4.0

type ConnMock struct {
	Remote net.Addr
}

func (ConnMock) Close added in v1.4.0

func (c ConnMock) Close() error

func (ConnMock) LocalAddr added in v1.4.0

func (c ConnMock) LocalAddr() net.Addr

func (ConnMock) Read added in v1.4.0

func (c ConnMock) Read(b []byte) (n int, err error)

func (ConnMock) RemoteAddr added in v1.4.0

func (c ConnMock) RemoteAddr() net.Addr

func (ConnMock) SetDeadline added in v1.4.0

func (c ConnMock) SetDeadline(t time.Time) error

func (ConnMock) SetReadDeadline added in v1.4.0

func (c ConnMock) SetReadDeadline(t time.Time) error

func (*ConnMock) SetWriteDeadline added in v1.4.0

func (c *ConnMock) SetWriteDeadline(t time.Time) error

func (ConnMock) Write added in v1.4.0

func (c ConnMock) Write(b []byte) (n int, err error)

type IssuerMock

type IssuerMock struct {
	// IssueFunc mocks the Issue method.
	IssueFunc func(in1 context.Context, in2 string, in3 *certify.CertConfig) (*tls.Certificate, error)
	// contains filtered or unexported fields
}

IssuerMock is a mock implementation of Issuer.

    func TestSomethingThatUsesIssuer(t *testing.T) {

        // make and configure a mocked Issuer
        mockedIssuer := &IssuerMock{
            IssueFunc: func(in1 context.Context, in2 string, in3 *certify.CertConfig) (*tls.Certificate, error) {
	               panic("mock out the Issue method")
            },
        }

        // use mockedIssuer in code that requires Issuer
        // and then make assertions.

    }

func (*IssuerMock) Issue

func (mock *IssuerMock) Issue(in1 context.Context, in2 string, in3 *certify.CertConfig) (*tls.Certificate, error)

Issue calls IssueFunc.

func (*IssuerMock) IssueCalls

func (mock *IssuerMock) IssueCalls() []struct {
	In1 context.Context
	In2 string
	In3 *certify.CertConfig
}

IssueCalls gets all the calls that were made to Issue. Check the length with:

len(mockedIssuer.IssueCalls())

type LoggerMock added in v1.4.0

type LoggerMock struct {
	// DebugFunc mocks the Debug method.
	DebugFunc func(msg string, fields ...map[string]interface{})

	// ErrorFunc mocks the Error method.
	ErrorFunc func(msg string, fields ...map[string]interface{})

	// InfoFunc mocks the Info method.
	InfoFunc func(msg string, fields ...map[string]interface{})

	// TraceFunc mocks the Trace method.
	TraceFunc func(msg string, fields ...map[string]interface{})

	// WarnFunc mocks the Warn method.
	WarnFunc func(msg string, fields ...map[string]interface{})
	// contains filtered or unexported fields
}

LoggerMock is a mock implementation of Logger.

    func TestSomethingThatUsesLogger(t *testing.T) {

        // make and configure a mocked Logger
        mockedLogger := &LoggerMock{
            DebugFunc: func(msg string, fields ...map[string]interface{})  {
	               panic("mock out the Debug method")
            },
            ErrorFunc: func(msg string, fields ...map[string]interface{})  {
	               panic("mock out the Error method")
            },
            InfoFunc: func(msg string, fields ...map[string]interface{})  {
	               panic("mock out the Info method")
            },
            TraceFunc: func(msg string, fields ...map[string]interface{})  {
	               panic("mock out the Trace method")
            },
            WarnFunc: func(msg string, fields ...map[string]interface{})  {
	               panic("mock out the Warn method")
            },
        }

        // use mockedLogger in code that requires Logger
        // and then make assertions.

    }

func (*LoggerMock) Debug added in v1.4.0

func (mock *LoggerMock) Debug(msg string, fields ...map[string]interface{})

Debug calls DebugFunc.

func (*LoggerMock) DebugCalls added in v1.4.0

func (mock *LoggerMock) DebugCalls() []struct {
	Msg    string
	Fields []map[string]interface{}
}

DebugCalls gets all the calls that were made to Debug. Check the length with:

len(mockedLogger.DebugCalls())

func (*LoggerMock) Error added in v1.4.0

func (mock *LoggerMock) Error(msg string, fields ...map[string]interface{})

Error calls ErrorFunc.

func (*LoggerMock) ErrorCalls added in v1.4.0

func (mock *LoggerMock) ErrorCalls() []struct {
	Msg    string
	Fields []map[string]interface{}
}

ErrorCalls gets all the calls that were made to Error. Check the length with:

len(mockedLogger.ErrorCalls())

func (*LoggerMock) Info added in v1.4.0

func (mock *LoggerMock) Info(msg string, fields ...map[string]interface{})

Info calls InfoFunc.

func (*LoggerMock) InfoCalls added in v1.4.0

func (mock *LoggerMock) InfoCalls() []struct {
	Msg    string
	Fields []map[string]interface{}
}

InfoCalls gets all the calls that were made to Info. Check the length with:

len(mockedLogger.InfoCalls())

func (*LoggerMock) Trace added in v1.4.0

func (mock *LoggerMock) Trace(msg string, fields ...map[string]interface{})

Trace calls TraceFunc.

func (*LoggerMock) TraceCalls added in v1.4.0

func (mock *LoggerMock) TraceCalls() []struct {
	Msg    string
	Fields []map[string]interface{}
}

TraceCalls gets all the calls that were made to Trace. Check the length with:

len(mockedLogger.TraceCalls())

func (*LoggerMock) Warn added in v1.4.0

func (mock *LoggerMock) Warn(msg string, fields ...map[string]interface{})

Warn calls WarnFunc.

func (*LoggerMock) WarnCalls added in v1.4.0

func (mock *LoggerMock) WarnCalls() []struct {
	Msg    string
	Fields []map[string]interface{}
}

WarnCalls gets all the calls that were made to Warn. Check the length with:

len(mockedLogger.WarnCalls())

Jump to

Keyboard shortcuts

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