Documentation ¶
Index ¶
- type UserBackendMock
- func (mock *UserBackendMock) Authenticate(ctx context.Context, username string, password string) (*userv1beta1.User, string, error)
- func (mock *UserBackendMock) AuthenticateCalls() []struct{ ... }
- func (mock *UserBackendMock) CreateUserFromClaims(ctx context.Context, claims map[string]interface{}) (*userv1beta1.User, error)
- func (mock *UserBackendMock) CreateUserFromClaimsCalls() []struct{ ... }
- func (mock *UserBackendMock) GetUserByClaims(ctx context.Context, claim string, value string, withRoles bool) (*userv1beta1.User, string, error)
- func (mock *UserBackendMock) GetUserByClaimsCalls() []struct{ ... }
- func (mock *UserBackendMock) GetUserGroups(ctx context.Context, userID string)
- func (mock *UserBackendMock) GetUserGroupsCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserBackendMock ¶
type UserBackendMock struct { // AuthenticateFunc mocks the Authenticate method. AuthenticateFunc func(ctx context.Context, username string, password string) (*userv1beta1.User, string, error) // CreateUserFromClaimsFunc mocks the CreateUserFromClaims method. CreateUserFromClaimsFunc func(ctx context.Context, claims map[string]interface{}) (*userv1beta1.User, error) // GetUserByClaimsFunc mocks the GetUserByClaims method. GetUserByClaimsFunc func(ctx context.Context, claim string, value string, withRoles bool) (*userv1beta1.User, string, error) // GetUserGroupsFunc mocks the GetUserGroups method. GetUserGroupsFunc func(ctx context.Context, userID string) // contains filtered or unexported fields }
UserBackendMock is a mock implementation of UserBackend.
func TestSomethingThatUsesUserBackend(t *testing.T) { // make and configure a mocked UserBackend mockedUserBackend := &UserBackendMock{ AuthenticateFunc: func(ctx context.Context, username string, password string) (*userv1beta1.User, error) { panic("mock out the Authenticate method") }, CreateUserFromClaimsFunc: func(ctx context.Context, claims *oidc.StandardClaims) (*userv1beta1.User, error) { panic("mock out the CreateUserFromClaims method") }, GetUserByClaimsFunc: func(ctx context.Context, claim string, value string, withRoles bool) (*userv1beta1.User, error) { panic("mock out the GetUserByClaims method") }, GetUserGroupsFunc: func(ctx context.Context, userID string) { panic("mock out the GetUserGroups method") }, } // use mockedUserBackend in code that requires UserBackend // and then make assertions. }
func (*UserBackendMock) Authenticate ¶
func (mock *UserBackendMock) Authenticate(ctx context.Context, username string, password string) (*userv1beta1.User, string, error)
Authenticate calls AuthenticateFunc.
func (*UserBackendMock) AuthenticateCalls ¶
func (mock *UserBackendMock) AuthenticateCalls() []struct { Ctx context.Context Username string Password string }
AuthenticateCalls gets all the calls that were made to Authenticate. Check the length with:
len(mockedUserBackend.AuthenticateCalls())
func (*UserBackendMock) CreateUserFromClaims ¶
func (mock *UserBackendMock) CreateUserFromClaims(ctx context.Context, claims map[string]interface{}) (*userv1beta1.User, error)
CreateUserFromClaims calls CreateUserFromClaimsFunc.
func (*UserBackendMock) CreateUserFromClaimsCalls ¶
func (mock *UserBackendMock) CreateUserFromClaimsCalls() []struct { Ctx context.Context Claims map[string]interface{} }
CreateUserFromClaimsCalls gets all the calls that were made to CreateUserFromClaims. Check the length with:
len(mockedUserBackend.CreateUserFromClaimsCalls())
func (*UserBackendMock) GetUserByClaims ¶
func (mock *UserBackendMock) GetUserByClaims(ctx context.Context, claim string, value string, withRoles bool) (*userv1beta1.User, string, error)
GetUserByClaims calls GetUserByClaimsFunc.
func (*UserBackendMock) GetUserByClaimsCalls ¶
func (mock *UserBackendMock) GetUserByClaimsCalls() []struct { Ctx context.Context Claim string Value string WithRoles bool }
GetUserByClaimsCalls gets all the calls that were made to GetUserByClaims. Check the length with:
len(mockedUserBackend.GetUserByClaimsCalls())
func (*UserBackendMock) GetUserGroups ¶
func (mock *UserBackendMock) GetUserGroups(ctx context.Context, userID string)
GetUserGroups calls GetUserGroupsFunc.
func (*UserBackendMock) GetUserGroupsCalls ¶
func (mock *UserBackendMock) GetUserGroupsCalls() []struct { Ctx context.Context UserID string }
GetUserGroupsCalls gets all the calls that were made to GetUserGroups. Check the length with:
len(mockedUserBackend.GetUserGroupsCalls())
Click to show internal directories.
Click to hide internal directories.