mock

package
v2.157.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TokenIdentityMock

type TokenIdentityMock struct {
	// CheckTokenIdentityFunc mocks the CheckTokenIdentity method.
	CheckTokenIdentityFunc func(ctx context.Context, token string, tokenType identity.TokenType) (*dprequest.IdentityResponse, error)
	// contains filtered or unexported fields
}

TokenIdentityMock is a mock implementation of identity.TokenIdentity.

func TestSomethingThatUsesTokenIdentity(t *testing.T) {

	// make and configure a mocked identity.TokenIdentity
	mockedTokenIdentity := &TokenIdentityMock{
		CheckTokenIdentityFunc: func(ctx context.Context, token string, tokenType identity.TokenType) (*dprequest.IdentityResponse, error) {
			panic("mock out the CheckTokenIdentity method")
		},
	}

	// use mockedTokenIdentity in code that requires identity.TokenIdentity
	// and then make assertions.

}

func (*TokenIdentityMock) CheckTokenIdentity

func (mock *TokenIdentityMock) CheckTokenIdentity(ctx context.Context, token string, tokenType identity.TokenType) (*dprequest.IdentityResponse, error)

CheckTokenIdentity calls CheckTokenIdentityFunc.

func (*TokenIdentityMock) CheckTokenIdentityCalls

func (mock *TokenIdentityMock) CheckTokenIdentityCalls() []struct {
	Ctx       context.Context
	Token     string
	TokenType identity.TokenType
}

CheckTokenIdentityCalls gets all the calls that were made to CheckTokenIdentity. Check the length with:

len(mockedTokenIdentity.CheckTokenIdentityCalls())

Jump to

Keyboard shortcuts

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