Documentation
¶
Index ¶
- type Connection
- type ConnectionMock
- func (mock *ConnectionMock) API() api.API
- func (mock *ConnectionMock) APICalls() []struct{}
- func (mock *ConnectionMock) Logout(ctx context.Context) error
- func (mock *ConnectionMock) LogoutCalls() []struct{ ... }
- func (mock *ConnectionMock) RefreshTokens(ctx context.Context) error
- func (mock *ConnectionMock) RefreshTokensCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection interface {
// Method to refresh the OAuth tokens
RefreshTokens(ctx context.Context) error
// Method to perform a logout request to the authentication server
Logout(ctx context.Context) error
// Method to create the API clients
API() api.API
}
Connection is an interface which defines methods for interacting with the control plane API and the authentication server
type ConnectionMock ¶
type ConnectionMock struct {
// APIFunc mocks the API method.
APIFunc func() api.API
// LogoutFunc mocks the Logout method.
LogoutFunc func(ctx context.Context) error
// RefreshTokensFunc mocks the RefreshTokens method.
RefreshTokensFunc func(ctx context.Context) error
// contains filtered or unexported fields
}
ConnectionMock is a mock implementation of Connection.
func TestSomethingThatUsesConnection(t *testing.T) {
// make and configure a mocked Connection
mockedConnection := &ConnectionMock{
APIFunc: func() apis.API {
panic("mock out the API method")
},
LogoutFunc: func(ctx context.Context) error {
panic("mock out the Logout method")
},
RefreshTokensFunc: func(ctx context.Context) error {
panic("mock out the RefreshTokens method")
},
}
// use mockedConnection in code that requires Connection
// and then make assertions.
}
func (*ConnectionMock) APICalls ¶
func (mock *ConnectionMock) APICalls() []struct { }
APICalls gets all the calls that were made to API. Check the length with:
len(mockedConnection.APICalls())
func (*ConnectionMock) Logout ¶
func (mock *ConnectionMock) Logout(ctx context.Context) error
Logout calls LogoutFunc.
func (*ConnectionMock) LogoutCalls ¶
func (mock *ConnectionMock) LogoutCalls() []struct { Ctx context.Context }
LogoutCalls gets all the calls that were made to Logout. Check the length with:
len(mockedConnection.LogoutCalls())
func (*ConnectionMock) RefreshTokens ¶
func (mock *ConnectionMock) RefreshTokens(ctx context.Context) error
RefreshTokens calls RefreshTokensFunc.
func (*ConnectionMock) RefreshTokensCalls ¶
func (mock *ConnectionMock) RefreshTokensCalls() []struct { Ctx context.Context }
RefreshTokensCalls gets all the calls that were made to RefreshTokens. Check the length with:
len(mockedConnection.RefreshTokensCalls())
Click to show internal directories.
Click to hide internal directories.