mock

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientMock

type ClientMock struct {
	// KeyPresenceFunc mocks the KeyPresence method.
	KeyPresenceFunc func(ctx context.Context, in *tofnd.KeyPresenceRequest, opts ...grpc.CallOption) (*tofnd.KeyPresenceResponse, error)

	// KeygenFunc mocks the Keygen method.
	KeygenFunc func(ctx context.Context, in *tofnd.KeygenRequest, opts ...grpc.CallOption) (*tofnd.KeygenResponse, error)

	// SignFunc mocks the Sign method.
	SignFunc func(ctx context.Context, in *tofnd.SignRequest, opts ...grpc.CallOption) (*tofnd.SignResponse, error)
	// contains filtered or unexported fields
}

ClientMock is a mock implementation of multisig.Client.

func TestSomethingThatUsesClient(t *testing.T) {

	// make and configure a mocked multisig.Client
	mockedClient := &ClientMock{
		KeyPresenceFunc: func(ctx context.Context, in *tofnd.KeyPresenceRequest, opts ...grpc.CallOption) (*tofnd.KeyPresenceResponse, error) {
			panic("mock out the KeyPresence method")
		},
		KeygenFunc: func(ctx context.Context, in *tofnd.KeygenRequest, opts ...grpc.CallOption) (*tofnd.KeygenResponse, error) {
			panic("mock out the Keygen method")
		},
		SignFunc: func(ctx context.Context, in *tofnd.SignRequest, opts ...grpc.CallOption) (*tofnd.SignResponse, error) {
			panic("mock out the Sign method")
		},
	}

	// use mockedClient in code that requires multisig.Client
	// and then make assertions.

}

func (*ClientMock) KeyPresence

KeyPresence calls KeyPresenceFunc.

func (*ClientMock) KeyPresenceCalls

func (mock *ClientMock) KeyPresenceCalls() []struct {
	Ctx  context.Context
	In   *tofnd.KeyPresenceRequest
	Opts []grpc.CallOption
}

KeyPresenceCalls gets all the calls that were made to KeyPresence. Check the length with:

len(mockedClient.KeyPresenceCalls())

func (*ClientMock) Keygen

func (mock *ClientMock) Keygen(ctx context.Context, in *tofnd.KeygenRequest, opts ...grpc.CallOption) (*tofnd.KeygenResponse, error)

Keygen calls KeygenFunc.

func (*ClientMock) KeygenCalls

func (mock *ClientMock) KeygenCalls() []struct {
	Ctx  context.Context
	In   *tofnd.KeygenRequest
	Opts []grpc.CallOption
}

KeygenCalls gets all the calls that were made to Keygen. Check the length with:

len(mockedClient.KeygenCalls())

func (*ClientMock) Sign

func (mock *ClientMock) Sign(ctx context.Context, in *tofnd.SignRequest, opts ...grpc.CallOption) (*tofnd.SignResponse, error)

Sign calls SignFunc.

func (*ClientMock) SignCalls

func (mock *ClientMock) SignCalls() []struct {
	Ctx  context.Context
	In   *tofnd.SignRequest
	Opts []grpc.CallOption
}

SignCalls gets all the calls that were made to Sign. Check the length with:

len(mockedClient.SignCalls())

Jump to

Keyboard shortcuts

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