fleet/server/mock/datastore_users_helpers.go
Martin Angers 4f4185372d
Add support for context in datastore/mysql layer (#1962)
This is just to pass down the context to the datastore layer, it doesn't
use it just yet - this will be in a follow-up PR.
2021-09-14 08:11:07 -04:00

26 lines
524 B
Go

package mock
import (
"context"
"github.com/fleetdm/fleet/v4/server/fleet"
)
func UserByEmailWithUser(u *fleet.User) UserByEmailFunc {
return func(ctx context.Context, email string) (*fleet.User, error) {
return u, nil
}
}
func UserWithEmailNotFound() UserByEmailFunc {
return func(ctx context.Context, email string) (*fleet.User, error) {
return nil, &Error{"not found"}
}
}
func UserWithID(u *fleet.User) UserByIDFunc {
return func(ctx context.Context, id uint) (*fleet.User, error) {
return u, nil
}
}