snapshot of https://github.com/traggo/server.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
build / build (push) Failing after 3s

This commit is contained in:
upstream-mirror
2026-09-16 05:24:45 +05:00
commit cda7c1a474
272 changed files with 31973 additions and 0 deletions

13
test/fake/device.go Normal file
View File

@@ -0,0 +1,13 @@
package fake
import (
"context"
"github.com/traggo/server/auth"
"github.com/traggo/server/model"
)
// Device creates a context with a fake device.
func Device(device *model.Device) context.Context {
return auth.WithDevice(context.Background(), device)
}

22
test/fake/user.go Normal file
View File

@@ -0,0 +1,22 @@
package fake
import (
"context"
"github.com/traggo/server/auth"
"github.com/traggo/server/model"
)
// User create a context with a fake user.
func User(id int) context.Context {
return UserWithPerm(id, true)
}
// UserWithPerm create a context with a fake user.
func UserWithPerm(id int, admin bool) context.Context {
return auth.WithUser(context.Background(), &model.User{
ID: id,
Name: "fake",
Admin: admin,
})
}