chore: Add test for non-2xx responses from idTokenWithAudience calls#1656
Merged
chore: Add test for non-2xx responses from idTokenWithAudience calls#1656
Conversation
lqiu96
commented
Feb 5, 2025
| public void idTokenWithAudience_oauthEndpoint_non2XXStatusCode() throws IOException { | ||
| String universeDomain = "test.com"; | ||
| MockTokenServerTransportFactory transportFactory = new MockTokenServerTransportFactory(); | ||
| transportFactory.transport.setError(new IOException("404 Not Found")); |
Member
Author
There was a problem hiding this comment.
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");.
zhumin8
reviewed
Feb 6, 2025
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
|
zhumin8
approved these changes
Feb 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




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
idTokenWithAudienceare correctly caught.Fixes #1027