(t *testing.T)
| 231 | } |
| 232 | |
| 233 | func TestWithAccount(t *testing.T) { |
| 234 | db := testutils.InitMemoryDB(t) |
| 235 | |
| 236 | handler := func(w http.ResponseWriter, r *http.Request) { |
| 237 | w.WriteHeader(http.StatusOK) |
| 238 | } |
| 239 | |
| 240 | t.Run("authenticated user", func(t *testing.T) { |
| 241 | user := testutils.SetupUserData(db, "alice@test.com", "pass1234") |
| 242 | |
| 243 | server := httptest.NewServer(Auth(db, handler, nil)) |
| 244 | defer server.Close() |
| 245 | |
| 246 | req := testutils.MakeReq(server.URL, "GET", "/", "") |
| 247 | res := testutils.HTTPAuthDo(t, db, req, user) |
| 248 | |
| 249 | assert.Equal(t, res.StatusCode, http.StatusOK, "status code mismatch") |
| 250 | }) |
| 251 | } |
nothing calls this directly
no test coverage detected