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

Method TestUserUpdateEmail

internal/api/user_test.go:87–204  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85}
86
87func (ts *UserTestSuite) TestUserUpdateEmail() {
88 cases := []struct {
89 desc string
90 userData map[string]interface{}
91 isSecureEmailChangeEnabled bool
92 isMailerAutoconfirmEnabled bool
93 expectedCode int
94 }{
95 {
96 desc: "User doesn't have an existing email",
97 userData: map[string]interface{}{
98 "email": "",
99 "phone": "",
100 },
101 isSecureEmailChangeEnabled: false,
102 isMailerAutoconfirmEnabled: false,
103 expectedCode: http.StatusOK,
104 },
105 {
106 desc: "User doesn't have an existing email and double email confirmation required",
107 userData: map[string]interface{}{
108 "email": "",
109 "phone": "234567890",
110 },
111 isSecureEmailChangeEnabled: true,
112 isMailerAutoconfirmEnabled: false,
113 expectedCode: http.StatusOK,
114 },
115 {
116 desc: "User has an existing email",
117 userData: map[string]interface{}{
118 "email": "foo@example.com",
119 "phone": "",
120 },
121 isSecureEmailChangeEnabled: false,
122 isMailerAutoconfirmEnabled: false,
123 expectedCode: http.StatusOK,
124 },
125 {
126 desc: "User has an existing email and double email confirmation required",
127 userData: map[string]interface{}{
128 "email": "bar@example.com",
129 "phone": "",
130 },
131 isSecureEmailChangeEnabled: true,
132 isMailerAutoconfirmEnabled: false,
133 expectedCode: http.StatusOK,
134 },
135 {
136 desc: "Update email with mailer autoconfirm enabled",
137 userData: map[string]interface{}{
138 "email": "bar@example.com",
139 "phone": "",
140 },
141 isSecureEmailChangeEnabled: true,
142 isMailerAutoconfirmEnabled: true,
143 expectedCode: http.StatusOK,
144 },

Callers

nothing calls this directly

Calls 11

SetEmailMethod · 0.95
SetPhoneMethod · 0.95
GetEmailMethod · 0.95
NewUserFunction · 0.92
EncodeMethod · 0.80
SetMethod · 0.80
EqualMethod · 0.80
RunMethod · 0.65
ServeHTTPMethod · 0.45
DecodeMethod · 0.45

Tested by

no test coverage detected