fleet/server/test/context.go
2021-06-25 21:46:51 -07:00

14 lines
341 B
Go

package test
import (
"context"
"github.com/fleetdm/fleet/v4/server/contexts/viewer"
"github.com/fleetdm/fleet/v4/server/fleet"
)
// UserContext returns a new context with the provided user as the viewer.
func UserContext(user *fleet.User) context.Context {
return viewer.NewContext(context.Background(), viewer.Viewer{User: user})
}