oauthtokentest

package
v11.1.4-modfix Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockOauthTokenService

type MockOauthTokenService struct {
	GetCurrentOauthTokenFunc   func(ctx context.Context, usr identity.Requester) *oauth2.Token
	IsOAuthPassThruEnabledFunc func(ds *datasources.DataSource) bool
	HasOAuthEntryFunc          func(ctx context.Context, usr identity.Requester) (*login.UserAuth, bool, error)
	InvalidateOAuthTokensFunc  func(ctx context.Context, usr *login.UserAuth) error
	TryTokenRefreshFunc        func(ctx context.Context, usr identity.Requester) error
}

func (*MockOauthTokenService) GetCurrentOAuthToken

func (m *MockOauthTokenService) GetCurrentOAuthToken(ctx context.Context, usr identity.Requester) *oauth2.Token

func (*MockOauthTokenService) HasOAuthEntry

func (*MockOauthTokenService) InvalidateOAuthTokens

func (m *MockOauthTokenService) InvalidateOAuthTokens(ctx context.Context, usr *login.UserAuth) error

func (*MockOauthTokenService) IsOAuthPassThruEnabled

func (m *MockOauthTokenService) IsOAuthPassThruEnabled(ds *datasources.DataSource) bool

func (*MockOauthTokenService) TryTokenRefresh

func (m *MockOauthTokenService) TryTokenRefresh(ctx context.Context, usr identity.Requester) error

type MockService

type MockService struct {
	mock.Mock
}

MockService is an autogenerated mock type for the OAuthTokenService type

func NewMockService

func NewMockService(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockService

NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockService) GetCurrentOAuthToken

func (_m *MockService) GetCurrentOAuthToken(_a0 context.Context, _a1 identity.Requester) *oauth2.Token

GetCurrentOAuthToken provides a mock function with given fields: _a0, _a1

func (*MockService) HasOAuthEntry

func (_m *MockService) HasOAuthEntry(_a0 context.Context, _a1 identity.Requester) (*login.UserAuth, bool, error)

HasOAuthEntry provides a mock function with given fields: _a0, _a1

func (*MockService) InvalidateOAuthTokens

func (_m *MockService) InvalidateOAuthTokens(_a0 context.Context, _a1 *login.UserAuth) error

InvalidateOAuthTokens provides a mock function with given fields: _a0, _a1

func (*MockService) IsOAuthPassThruEnabled

func (_m *MockService) IsOAuthPassThruEnabled(_a0 *datasources.DataSource) bool

IsOAuthPassThruEnabled provides a mock function with given fields: _a0

func (*MockService) TryTokenRefresh

func (_m *MockService) TryTokenRefresh(_a0 context.Context, _a1 identity.Requester) error

TryTokenRefresh provides a mock function with given fields: _a0, _a1

type Service

type Service struct {
	Token *oauth2.Token
}

Service an OAuth token service suitable for tests.

func ProvideService

func ProvideService() *Service

ProvideService provides an OAuth token service suitable for tests.

func (*Service) GetCurrentOAuthToken

func (s *Service) GetCurrentOAuthToken(context.Context, identity.Requester) *oauth2.Token

func (*Service) HasOAuthEntry

func (s *Service) HasOAuthEntry(context.Context, identity.Requester) (*login.UserAuth, bool, error)

func (*Service) InvalidateOAuthTokens

func (s *Service) InvalidateOAuthTokens(context.Context, *login.UserAuth) error

func (*Service) IsOAuthPassThruEnabled

func (s *Service) IsOAuthPassThruEnabled(ds *datasources.DataSource) bool

func (*Service) TryTokenRefresh

func (s *Service) TryTokenRefresh(context.Context, identity.Requester) error

Jump to

Keyboard shortcuts

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