(t *testing.T)
| 359 | } |
| 360 | |
| 361 | func TestMiddlewareRequireAttributeNotPresent(t *testing.T) { |
| 362 | test := NewMiddlewareTest(t) |
| 363 | handler := test.Middleware.RequireAccount( |
| 364 | RequireAttribute("valueThatDoesntExist", "doesntMatter")( |
| 365 | http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 366 | panic("not reached") |
| 367 | }))) |
| 368 | |
| 369 | req, _ := http.NewRequest("GET", "/frob", nil) |
| 370 | req.Header.Set("Cookie", ""+ |
| 371 | "ttt="+test.expectedSessionCookie+"; "+ |
| 372 | "Path=/; Max-Age=7200") |
| 373 | resp := httptest.NewRecorder() |
| 374 | handler.ServeHTTP(resp, req) |
| 375 | |
| 376 | assert.Check(t, is.Equal(http.StatusForbidden, resp.Code)) |
| 377 | } |
| 378 | |
| 379 | func TestMiddlewareRequireAttributeMissingAccount(t *testing.T) { |
| 380 | test := NewMiddlewareTest(t) |
nothing calls this directly
no test coverage detected