MCPcopy Create free account
hub / github.com/supabase/auth / TestAdminUserCreate

Method TestAdminUserCreate

internal/api/admin_test.go:231–403  ·  view source on GitHub ↗

TestAdminUserCreate tests API /admin/user route (POST)

()

Source from the content-addressed store, hash-verified

229
230// TestAdminUserCreate tests API /admin/user route (POST)
231func (ts *AdminTestSuite) TestAdminUserCreate() {
232 cases := []struct {
233 desc string
234 params map[string]interface{}
235 expected map[string]interface{}
236 }{
237 {
238 desc: "Only phone",
239 params: map[string]interface{}{
240 "phone": "123456789",
241 "password": "test1",
242 },
243 expected: map[string]interface{}{
244 "email": "",
245 "phone": "123456789",
246 "isAuthenticated": true,
247 "provider": "phone",
248 "providers": []string{"phone"},
249 "password": "test1",
250 },
251 },
252 {
253 desc: "With password",
254 params: map[string]interface{}{
255 "email": "test1@example.com",
256 "phone": "123456789",
257 "password": "test1",
258 },
259 expected: map[string]interface{}{
260 "email": "test1@example.com",
261 "phone": "123456789",
262 "isAuthenticated": true,
263 "provider": "email",
264 "providers": []string{"email", "phone"},
265 "password": "test1",
266 },
267 },
268 {
269 desc: "Without password",
270 params: map[string]interface{}{
271 "email": "test2@example.com",
272 "phone": "",
273 },
274 expected: map[string]interface{}{
275 "email": "test2@example.com",
276 "phone": "",
277 "isAuthenticated": false,
278 "provider": "email",
279 "providers": []string{"email"},
280 },
281 },
282 {
283 desc: "With empty string password",
284 params: map[string]interface{}{
285 "email": "test3@example.com",
286 "phone": "",
287 "password": "",
288 },

Callers

nothing calls this directly

Calls 10

GetEmailMethod · 0.95
GetPhoneMethod · 0.95
FindUserByIDFunction · 0.92
EncodeMethod · 0.80
SetMethod · 0.80
EqualMethod · 0.80
AuthenticateMethod · 0.80
RunMethod · 0.65
ServeHTTPMethod · 0.45
DecodeMethod · 0.45

Tested by

no test coverage detected