(t *testing.T)
| 234 | } |
| 235 | |
| 236 | func TestJoinDisabled(t *testing.T) { |
| 237 | db := testutils.InitMemoryDB(t) |
| 238 | |
| 239 | // Setup |
| 240 | a := app.NewTest() |
| 241 | a.Clock = clock.NewMock() |
| 242 | a.DB = db |
| 243 | a.DisableRegistration = true |
| 244 | server := MustNewServer(t, &a) |
| 245 | defer server.Close() |
| 246 | |
| 247 | dat := url.Values{} |
| 248 | dat.Set("email", "alice@example.com") |
| 249 | dat.Set("password", "foobarbaz") |
| 250 | req := testutils.MakeFormReq(server.URL, "POST", "/join", dat) |
| 251 | |
| 252 | // Execute |
| 253 | res := testutils.HTTPDo(t, req) |
| 254 | |
| 255 | // Test |
| 256 | assert.StatusCodeEquals(t, res, http.StatusNotFound, "status code mismatch") |
| 257 | |
| 258 | var userCount int64 |
| 259 | testutils.MustExec(t, db.Model(&database.User{}).Count(&userCount), "counting user") |
| 260 | |
| 261 | assert.Equal(t, userCount, int64(0), "user count mismatch") |
| 262 | } |
| 263 | |
| 264 | func TestLogin(t *testing.T) { |
| 265 | testutils.RunForWebAndAPI(t, "success", func(t *testing.T, target testutils.EndpointType) { |
nothing calls this directly
no test coverage detected