(t *testing.T)
| 384 | } |
| 385 | |
| 386 | func TestHandleCallback_InvalidState_Rejected(t *testing.T) { |
| 387 | ua, _, srv := setupUserAuthWithFakeOAuth(t) |
| 388 | |
| 389 | req := httptest.NewRequest( |
| 390 | http.MethodGet, |
| 391 | "/api/auth/callback?code=fake-code&state=not-valid-base64!!!", |
| 392 | nil, |
| 393 | ) |
| 394 | req.AddCookie(&http.Cookie{Name: "e2a_oauth_state", Value: "whatever"}) |
| 395 | _ = srv |
| 396 | w := httptest.NewRecorder() |
| 397 | |
| 398 | ua.HandleCallback(w, req) |
| 399 | |
| 400 | if w.Code != http.StatusBadRequest { |
| 401 | t.Fatalf("status = %d, want %d", w.Code, http.StatusBadRequest) |
| 402 | } |
| 403 | } |
nothing calls this directly
no test coverage detected