Documentation
¶
Index ¶
- type CredentialRepoMock
- func (mock *CredentialRepoMock) Count(ctx context.Context, email string) int
- func (mock *CredentialRepoMock) CountCalls() []struct{ ... }
- func (mock *CredentialRepoMock) Create(ctx context.Context, cred model.Credential) error
- func (mock *CredentialRepoMock) CreateCalls() []struct{ ... }
- func (mock *CredentialRepoMock) Get(ctx context.Context, email string) (model.Credential, error)
- func (mock *CredentialRepoMock) GetCalls() []struct{ ... }
- func (mock *CredentialRepoMock) Update(ctx context.Context, email string, cred model.Credential) (model.Credential, error)
- func (mock *CredentialRepoMock) UpdateCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CredentialRepoMock ¶
type CredentialRepoMock struct {
// CountFunc mocks the Count method.
CountFunc func(ctx context.Context, email string) int
// CreateFunc mocks the Create method.
CreateFunc func(ctx context.Context, cred model.Credential) error
// GetFunc mocks the Get method.
GetFunc func(ctx context.Context, email string) (model.Credential, error)
// UpdateFunc mocks the Update method.
UpdateFunc func(ctx context.Context, email string, cred model.Credential) (model.Credential, error)
// contains filtered or unexported fields
}
CredentialRepoMock is a mock implementation of CredentialRepo.
func TestSomethingThatUsesCredentialRepo(t *testing.T) {
// make and configure a mocked CredentialRepo
mockedCredentialRepo := &CredentialRepoMock{
CountFunc: func(ctx context.Context, email string) int {
panic("mock out the Count method")
},
CreateFunc: func(ctx context.Context, cred model.Credential) error {
panic("mock out the Create method")
},
GetFunc: func(ctx context.Context, email string) (model.Credential, error) {
panic("mock out the Get method")
},
UpdateFunc: func(ctx context.Context, email string, cred model.Credential) (model.Credential, error) {
panic("mock out the Update method")
},
}
// use mockedCredentialRepo in code that requires CredentialRepo
// and then make assertions.
}
func (*CredentialRepoMock) Count ¶
func (mock *CredentialRepoMock) Count(ctx context.Context, email string) int
Count calls CountFunc.
func (*CredentialRepoMock) CountCalls ¶
func (mock *CredentialRepoMock) CountCalls() []struct { Ctx context.Context Email string }
CountCalls gets all the calls that were made to Count. Check the length with:
len(mockedCredentialRepo.CountCalls())
func (*CredentialRepoMock) Create ¶
func (mock *CredentialRepoMock) Create(ctx context.Context, cred model.Credential) error
Create calls CreateFunc.
func (*CredentialRepoMock) CreateCalls ¶
func (mock *CredentialRepoMock) CreateCalls() []struct { Ctx context.Context Cred model.Credential }
CreateCalls gets all the calls that were made to Create. Check the length with:
len(mockedCredentialRepo.CreateCalls())
func (*CredentialRepoMock) Get ¶
func (mock *CredentialRepoMock) Get(ctx context.Context, email string) (model.Credential, error)
Get calls GetFunc.
func (*CredentialRepoMock) GetCalls ¶
func (mock *CredentialRepoMock) GetCalls() []struct { Ctx context.Context Email string }
GetCalls gets all the calls that were made to Get. Check the length with:
len(mockedCredentialRepo.GetCalls())
func (*CredentialRepoMock) Update ¶
func (mock *CredentialRepoMock) Update(ctx context.Context, email string, cred model.Credential) (model.Credential, error)
Update calls UpdateFunc.
func (*CredentialRepoMock) UpdateCalls ¶
func (mock *CredentialRepoMock) UpdateCalls() []struct { Ctx context.Context Email string Cred model.Credential }
UpdateCalls gets all the calls that were made to Update. Check the length with:
len(mockedCredentialRepo.UpdateCalls())
Click to show internal directories.
Click to hide internal directories.