(t *testing.T)
| 76 | } |
| 77 | |
| 78 | func TestAuthorizationCodeGrant_InvalidGrant(t *testing.T) { |
| 79 | mux := http.NewServeMux() |
| 80 | mux.HandleFunc("/2/oauth/token", func(w http.ResponseWriter, r *http.Request) { |
| 81 | w.WriteHeader(http.StatusBadRequest) |
| 82 | require.NoError(t, json.NewEncoder(w).Encode(OAuthErrorResponse{ |
| 83 | Error: "invalid_grant", |
| 84 | ErrorDescription: "Authorization code has expired.", |
| 85 | })) |
| 86 | }) |
| 87 | |
| 88 | ts, client := newTestClient(mux) |
| 89 | defer ts.Close() |
| 90 | |
| 91 | _, err := client.AuthorizationCodeGrant("expired-code", "verifier", "http://localhost:12345") |
| 92 | assert.Error(t, err) |
| 93 | assert.Contains(t, err.Error(), "Authorization code has expired") |
| 94 | } |
| 95 | |
| 96 | func TestRefreshToken_Success(t *testing.T) { |
| 97 | mux := http.NewServeMux() |
nothing calls this directly
no test coverage detected