mocks

package
v0.12.9 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: AGPL-3.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 IntrospectorMock

type IntrospectorMock struct {
	// IntrospectFunc mocks the Introspect method.
	IntrospectFunc func(ctx context.Context, token string, requiredScope string) (*auth.IntrospectionResult, error)
	// contains filtered or unexported fields
}

IntrospectorMock is a mock implementation of auth.Introspector.

func TestSomethingThatUsesIntrospector(t *testing.T) {

	// make and configure a mocked auth.Introspector
	mockedIntrospector := &IntrospectorMock{
		IntrospectFunc: func(ctx context.Context, token string, requiredScope string) (*auth.IntrospectionResult, error) {
			panic("mock out the Introspect method")
		},
	}

	// use mockedIntrospector in code that requires auth.Introspector
	// and then make assertions.

}

func (*IntrospectorMock) Introspect

func (mock *IntrospectorMock) Introspect(ctx context.Context, token string, requiredScope string) (*auth.IntrospectionResult, error)

Introspect calls IntrospectFunc.

func (*IntrospectorMock) IntrospectCalls

func (mock *IntrospectorMock) IntrospectCalls() []struct {
	Ctx           context.Context
	Token         string
	RequiredScope string
}

IntrospectCalls gets all the calls that were made to Introspect. Check the length with:

len(mockedIntrospector.IntrospectCalls())

Jump to

Keyboard shortcuts

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