oauth2xmocks

package
v0.0.0-...-fb49ba0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 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 TokenSourceMock

type TokenSourceMock struct {
	// TokenFunc mocks the Token method.
	TokenFunc func() (*oauth2.Token, error)
	// contains filtered or unexported fields
}

TokenSourceMock is a mock implementation of oauth2x.TokenSource.

func TestSomethingThatUsesTokenSource(t *testing.T) {

	// make and configure a mocked oauth2x.TokenSource
	mockedTokenSource := &TokenSourceMock{
		TokenFunc: func() (*oauth2.Token, error) {
			panic("mock out the Token method")
		},
	}

	// use mockedTokenSource in code that requires oauth2x.TokenSource
	// and then make assertions.

}

func (*TokenSourceMock) Token

func (mock *TokenSourceMock) Token() (*oauth2.Token, error)

Token calls TokenFunc.

func (*TokenSourceMock) TokenCalls

func (mock *TokenSourceMock) TokenCalls() []struct {
}

TokenCalls gets all the calls that were made to Token. Check the length with:

len(mockedTokenSource.TokenCalls())

Jump to

Keyboard shortcuts

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