(t *testing.T, apiClient *hydra.APIClient, cb func(*testing.T, *hydra.OAuth2ConsentRequest, error) hydra.AcceptOAuth2ConsentRequest)
| 61 | } |
| 62 | |
| 63 | func checkAndAcceptConsentHandler(t *testing.T, apiClient *hydra.APIClient, cb func(*testing.T, *hydra.OAuth2ConsentRequest, error) hydra.AcceptOAuth2ConsentRequest) http.HandlerFunc { |
| 64 | return func(w http.ResponseWriter, r *http.Request) { |
| 65 | res, _, err := apiClient.OAuth2API.GetOAuth2ConsentRequest(context.Background()).ConsentChallenge(r.URL.Query().Get("consent_challenge")).Execute() |
| 66 | payload := cb(t, res, err) |
| 67 | |
| 68 | v, _, err := apiClient.OAuth2API.AcceptOAuth2ConsentRequest(context.Background()). |
| 69 | ConsentChallenge(res.Challenge). |
| 70 | AcceptOAuth2ConsentRequest(payload). |
| 71 | Execute() |
| 72 | require.NoError(t, err) |
| 73 | require.NotEmpty(t, v.RedirectTo) |
| 74 | http.Redirect(w, r, v.RedirectTo, http.StatusFound) |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | func makeOAuth2Request(t *testing.T, reg *driver.RegistrySQL, hc *http.Client, oc *client.Client, values url.Values) (gjson.Result, *http.Response) { |
| 79 | ctx := context.Background() |
no test coverage detected