mocks

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VerifierMock

type VerifierMock struct {
	// VerifyFunc mocks the Verify method.
	VerifyFunc func(ctx context.Context, token string) (*auth.Principal, error)
	// contains filtered or unexported fields
}

VerifierMock is a mock implementation of auth.Verifier.

func TestSomethingThatUsesVerifier(t *testing.T) {

	// make and configure a mocked auth.Verifier
	mockedVerifier := &VerifierMock{
		VerifyFunc: func(ctx context.Context, token string) (*auth.Principal, error) {
			panic("mock out the Verify method")
		},
	}

	// use mockedVerifier in code that requires auth.Verifier
	// and then make assertions.

}

func (*VerifierMock) Verify

func (mock *VerifierMock) Verify(ctx context.Context, token string) (*auth.Principal, error)

Verify calls VerifyFunc.

func (*VerifierMock) VerifyCalls

func (mock *VerifierMock) VerifyCalls() []struct {
	Ctx   context.Context
	Token string
}

VerifyCalls gets all the calls that were made to Verify. Check the length with:

len(mockedVerifier.VerifyCalls())

Jump to

Keyboard shortcuts

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