mirror of
https://github.com/gotify/server.git
synced 2026-05-09 06:49:36 +08:00
This uses a single struct for the authentication. This prevents further re-requesting of the already requested data.
13 lines
273 B
Go
13 lines
273 B
Go
package test
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/gotify/server/v2/auth"
|
|
"github.com/gotify/server/v2/model"
|
|
)
|
|
|
|
// WithUser fake an authentication for testing.
|
|
func WithUser(ctx *gin.Context, userID uint) {
|
|
auth.RegisterUser(ctx, &model.User{ID: userID})
|
|
}
|