Skip to content

test(auth): assert quota project header injection in google-auth tests#17448

Draft
westarle wants to merge 1 commit into
googleapis:mainfrom
westarle:fix-coverage-gap
Draft

test(auth): assert quota project header injection in google-auth tests#17448
westarle wants to merge 1 commit into
googleapis:mainfrom
westarle:fix-coverage-gap

Conversation

@westarle

Copy link
Copy Markdown

Other languages like Rust, .NET, and Swift have tests verifying that the user-project configuration propagates as an HTTP request header (x-goog-user-project). The Python auth tests were only checking that the quota project property was assigned, without asserting the outbound HTTP header payload.

@westarle westarle requested review from a team as code owners June 12, 2026 16:40

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates credential tests across several modules (including Compute Engine, OAuth2, Service Account, and External Account) to use the before_request method instead of apply when verifying that the x-goog-user-project header is correctly set. However, in packages/google-auth/tests/compute_engine/test_credentials.py, the request variable is used without being defined, which will cause a NameError during test execution. A mock request object should be defined to resolve this issue.

Comment thread packages/google-auth/tests/compute_engine/test_credentials.py
Other languages like Rust, .NET, and Swift have tests verifying that the user-project configuration propagates as an HTTP request header (x-goog-user-project). The Python auth tests were only checking that the quota project property was assigned, without asserting the outbound HTTP header payload.
@westarle westarle requested a review from a team as a code owner June 12, 2026 17:06

@daniel-sanche daniel-sanche left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to commit those extra files at the end?

@westarle westarle marked this pull request as draft June 13, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants