(t *testing.T)
| 533 | } |
| 534 | |
| 535 | func TestDoNotForwardAccessTokenUpstream(t *testing.T) { |
| 536 | patTest, err := NewPassAccessTokenTest(PassAccessTokenTestOptions{ |
| 537 | PassAccessToken: false, |
| 538 | ValidToken: true, |
| 539 | }) |
| 540 | if err != nil { |
| 541 | t.Fatal(err) |
| 542 | } |
| 543 | t.Cleanup(patTest.Close) |
| 544 | |
| 545 | // A successful validation will redirect and set the auth cookie. |
| 546 | code, cookie := patTest.getCallbackEndpoint() |
| 547 | if code != 302 { |
| 548 | t.Fatalf("expected 302; got %d", code) |
| 549 | } |
| 550 | assert.NotEqual(t, nil, cookie) |
| 551 | |
| 552 | // Now we make a regular request, but the access token header should |
| 553 | // not be present. |
| 554 | code, payload := patTest.getEndpointWithCookie(cookie, "/") |
| 555 | if code != 200 { |
| 556 | t.Fatalf("expected 200; got %d", code) |
| 557 | } |
| 558 | assert.Equal(t, "No access token found.", payload) |
| 559 | } |
| 560 | |
| 561 | func TestSessionValidationFailure(t *testing.T) { |
| 562 | patTest, err := NewPassAccessTokenTest(PassAccessTokenTestOptions{ |
nothing calls this directly
no test coverage detected