()
| 85 | } |
| 86 | |
| 87 | func (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 | }, |
nothing calls this directly
no test coverage detected