Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Options = struct { RepositoryGetUser map[string]repositoryGetUserValues RepositoryIsUserValid map[string]repositoryIsUserValidValues }{ RepositoryGetUser: map[string]repositoryGetUserValues{ "none": { UserID: 0, Response: &core.User{}, Error: nil, }, "default": { UserID: 1, Response: &core.User{ID: 1, Username: "gilperopiola"}, Error: nil, }, "err_not_found": { UserID: 0, Response: &core.User{}, Error: fmt.Errorf("user not found"), }, }, RepositoryIsUserValid: map[string]repositoryIsUserValidValues{ "valid": { UserID: 1, Valid: true, }, "invalid": { UserID: 1, Valid: false, }, }, }
Options holds all of the different cases each mock function will handle.
Functions ¶
This section is empty.
Types ¶
type RepositoryMock ¶
RepositoryMock is a mock of Repository interface.
func NewRepositoryMock ¶
func NewRepositoryMock() *RepositoryMock
NewRepositoryMock returns a new mock of the Repository interface.
func SetupRepositoryWithGetUser ¶
func SetupRepositoryWithGetUser(option string) *RepositoryMock
func SetupRepositoryWithIsUserValid ¶
func SetupRepositoryWithIsUserValid(mock *RepositoryMock, option string) *RepositoryMock
SetupRepositoryWithIsUserValid takes a mock as parameter because a previous mocked call to the GetUser method is needed.
func (*RepositoryMock) IsUserValid ¶
func (m *RepositoryMock) IsUserValid(id int) bool
Click to show internal directories.
Click to hide internal directories.