(ctx context.Context, db common.Store, s *testing.T)
| 40 | var encryptionPassphrase = "bocyasicgatEtenOubwonIbsudNutDom" |
| 41 | |
| 42 | func ImpersonateAdminContext(ctx context.Context, db common.Store, s *testing.T) context.Context { |
| 43 | adminUser, err := db.GetAdminUser(ctx) |
| 44 | if err != nil { |
| 45 | if !errors.Is(err, runnerErrors.ErrNotFound) { |
| 46 | s.Fatalf("failed to get admin user: %v", err) |
| 47 | } |
| 48 | newUserParams := params.NewUserParams{ |
| 49 | Email: "admin@localhost", |
| 50 | Username: "admin", |
| 51 | Password: "superSecretAdminPassword@123", |
| 52 | IsAdmin: true, |
| 53 | Enabled: true, |
| 54 | } |
| 55 | adminUser, err = db.CreateUser(ctx, newUserParams) |
| 56 | if err != nil { |
| 57 | s.Fatalf("failed to create admin user: %v", err) |
| 58 | } |
| 59 | } |
| 60 | ctx = auth.PopulateContext(ctx, adminUser, nil) |
| 61 | return ctx |
| 62 | } |
| 63 | |
| 64 | func CreateGARMTestUser(ctx context.Context, username string, db common.Store, s *testing.T) params.User { |
| 65 | newUserParams := params.NewUserParams{ |
nothing calls this directly
no test coverage detected