MCPcopy
hub / github.com/pocketbase/pocketbase / TestSuperuserUpdateCommand

Function TestSuperuserUpdateCommand

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

Source from the content-addressed store, hash-verified

176}
177
178func TestSuperuserUpdateCommand(t *testing.T) {
179 app, _ := tests.NewTestApp()
180 defer app.Cleanup()
181
182 scenarios := []struct {
183 name string
184 email string
185 password string
186 expectError bool
187 }{
188 {
189 "empty email and password",
190 "",
191 "",
192 true,
193 },
194 {
195 "empty email",
196 "",
197 "1234567890",
198 true,
199 },
200 {
201 "invalid email",
202 "invalid",
203 "1234567890",
204 true,
205 },
206 {
207 "nonexisting superuser",
208 "test_missing@example.com",
209 "1234567890",
210 true,
211 },
212 {
213 "empty password",
214 "test@example.com",
215 "",
216 true,
217 },
218 {
219 "short password",
220 "test_new@example.com",
221 "1234567",
222 true,
223 },
224 {
225 "valid email and password",
226 "test@example.com",
227 "12345678",
228 false,
229 },
230 }
231
232 for _, s := range scenarios {
233 t.Run(s.name, func(t *testing.T) {
234 command := cmd.NewSuperuserCommand(app)
235 command.SetArgs([]string{"update", s.email, s.password})

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…