(t *testing.T)
| 176 | } |
| 177 | |
| 178 | func 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}) |
nothing calls this directly
no test coverage detected
searching dependent graphs…