mock

package
v1.7.11 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectorMock

type ConnectorMock struct {
	mock.Mock
}

ConnectorMock has a `Connect` method that matches the signature of the Connector func type

func NewConnector

func NewConnector() *ConnectorMock

NewConnector creates mock with the `Connect` method that matches the signature of the Connector func type

func (*ConnectorMock) Connect

func (c *ConnectorMock) Connect(
	clientConn net.Conn,
	secrets connector.CredentialValuesByID,
) (backendConn net.Conn, err error)

Connect mocks the Connector func type

type CredentialRetrieverMock

type CredentialRetrieverMock struct {
	mock.Mock
}

CredentialRetrieverMock has a `RetrieveCredentials` method that matches the signature of the CredentialsRetriever func type

func NewCredentialRetriever

func NewCredentialRetriever() *CredentialRetrieverMock

NewCredentialRetriever creates a mock with the `RetrieveCredentials` method that matches the signature of the CredentialsRetriever func type

func (*CredentialRetrieverMock) RetrieveCredentials

func (cr *CredentialRetrieverMock) RetrieveCredentials() (bytes map[string][]byte, e error)

RetrieveCredentials mocks the CredentialsRetriever func type

type ListenerMock

type ListenerMock struct {
	net.Listener
	mock.Mock
}

ListenerMock conforms to the net.Listener interface

func NewListener

func NewListener() *ListenerMock

NewListener creates a net.Listener mock with an `Accept` method that returns the expectation values only on the first call, otherwise it blocks forever for all subsequent calls or if expected return values are not set.

func (*ListenerMock) Accept

func (l *ListenerMock) Accept() (net.Conn, error)

Accept mocks the method of the same name on the net.Listener interface. It is a special mock method that normally blocks forever. When expected return values are set it will return those for the first call.

func (*ListenerMock) Close

func (l *ListenerMock) Close() error

Close mocks the method of the same name on the net.Listener interface

Jump to

Keyboard shortcuts

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