MCPcopy
hub / github.com/pocketbase/pocketbase / TestSuperuserUpsertCommand

Function TestSuperuserUpsertCommand

cmd/superuser_test.go:12–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestSuperuserUpsertCommand(t *testing.T) {
13 t.Parallel()
14
15 app, _ := tests.NewTestApp()
16 defer app.Cleanup()
17
18 scenarios := []struct {
19 name string
20 email string
21 password string
22 expectError bool
23 }{
24 {
25 "empty email and password",
26 "",
27 "",
28 true,
29 },
30 {
31 "empty email",
32 "",
33 "1234567890",
34 true,
35 },
36 {
37 "invalid email",
38 "invalid",
39 "1234567890",
40 true,
41 },
42 {
43 "empty password",
44 "test@example.com",
45 "",
46 true,
47 },
48 {
49 "short password",
50 "test_new@example.com",
51 "1234567",
52 true,
53 },
54 {
55 "existing user",
56 "test@example.com",
57 "1234567890!",
58 false,
59 },
60 {
61 "new user",
62 "test_new@example.com",
63 "1234567890!",
64 false,
65 },
66 }
67
68 for _, s := range scenarios {
69 t.Run(s.name, func(t *testing.T) {

Callers

nothing calls this directly

Calls 7

CleanupMethod · 0.95
NewTestAppFunction · 0.92
NewSuperuserCommandFunction · 0.92
ExecuteMethod · 0.80
ValidatePasswordMethod · 0.80
FindAuthRecordByEmailMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…