(t *testing.T)
| 114 | } |
| 115 | |
| 116 | func TestNewAccessValidatorOk(t *testing.T) { |
| 117 | ctx := context.Background() |
| 118 | url := "test.cloudflareaccess.com" |
| 119 | access, err := NewAccessValidator(ctx, url, url, "") |
| 120 | |
| 121 | assert.NoError(t, err) |
| 122 | assert.NotNil(t, access) |
| 123 | |
| 124 | assert.Error(t, access.Validate(ctx, "")) |
| 125 | assert.Error(t, access.Validate(ctx, "invalid")) |
| 126 | |
| 127 | req := httptest.NewRequest("GET", "https://test.cloudflareaccess.com", nil) |
| 128 | req.Header.Set(accessJwtHeader, "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c") |
| 129 | assert.Error(t, access.ValidateRequest(ctx, req)) |
| 130 | } |
| 131 | |
| 132 | func TestNewAccessValidatorErr(t *testing.T) { |
| 133 | ctx := context.Background() |
nothing calls this directly
no test coverage detected