-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Add test for non-2xx responses from idTokenWithAudience calls #1656
Conversation
public void idTokenWithAudience_oauthEndpoint_non2XXStatusCode() throws IOException { | ||
String universeDomain = "test.com"; | ||
MockTokenServerTransportFactory transportFactory = new MockTokenServerTransportFactory(); | ||
transportFactory.transport.setError(new IOException("404 Not Found")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TokenServerTransportFactory sets an error response with setError(IOException)
. This could be refactored in the future to be similar to below .addStatusCodeAndMessage(HttpStatusCodes.STATUS_CODE_NOT_FOUND, "Not Found");
.
oauth2_http/javatests/com/google/auth/oauth2/ServiceAccountCredentialsTest.java
Outdated
Show resolved
Hide resolved
oauth2_http/javatests/com/google/auth/oauth2/ServiceAccountCredentialsTest.java
Show resolved
Hide resolved
|
I believe the issue that was reported in #1027 was actually resolved in #1636.
This PR is to add more tests to ensure that receiving non-2xx status codes back from the
idTokenWithAudience
are correctly caught.Fixes #1027