Skip to content

[Fix] Correct kwarg name in test_user_api_key_auth tests#24820

Merged
yuneng-berri merged 1 commit intomainfrom
litellm_fix_test_kwarg_name
Mar 30, 2026
Merged

[Fix] Correct kwarg name in test_user_api_key_auth tests#24820
yuneng-berri merged 1 commit intomainfrom
litellm_fix_test_kwarg_name

Conversation

@yuneng-berri
Copy link
Copy Markdown
Collaborator

Summary

Failure Path (Before Fix)

test_get_api_key_with_custom_litellm_key_header and related tests in test_user_api_key_auth.py fail with TypeError: get_api_key() got an unexpected keyword argument 'AZURE_AI_API_KEY_header'.

PR #24755 renamed azure_api_key_header to AZURE_AI_API_KEY_header in the test file but did not update the actual function signatures of get_api_key() and _user_api_key_auth_builder(), which still use azure_api_key_header.

Fix

Reverts the 4 kwarg name changes in the test file back to azure_api_key_header to match the function signatures.

Testing

pytest tests/test_litellm/proxy/auth/test_user_api_key_auth.py::test_get_api_key -v
pytest tests/test_litellm/proxy/auth/test_user_api_key_auth.py::test_get_api_key_with_custom_litellm_key_header -v

All 6 tests pass.

Type

🐛 Bug Fix
✅ Test

PR #24755 renamed `azure_api_key_header` to `AZURE_AI_API_KEY_header` in
the test file but did not update the actual function signatures of
`get_api_key()` and `_user_api_key_auth_builder()`, causing TypeError
on all affected test cases.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Mar 30, 2026 9:52pm

Request Review

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 30, 2026

Greptile Summary

This PR fixes a test regression introduced by PR #24755, which incorrectly renamed the azure_api_key_header kwarg to AZURE_AI_API_KEY_header in 4 test call sites within test_user_api_key_auth.py. The actual function signatures for get_api_key() and _user_api_key_auth_builder() in litellm/proxy/auth/user_api_key_auth.py were never updated to match, causing the tests to fail with TypeError: got an unexpected keyword argument 'AZURE_AI_API_KEY_header'.

Key changes:

  • Reverts 4 kwarg name changes in test_user_api_key_auth.py from AZURE_AI_API_KEY_header back to azure_api_key_header, aligning with the actual parameter names in the production code
  • No test assertions or logic were modified — only the argument names at the call sites are corrected
  • All 6 affected tests now pass (per the PR description)

Confidence Score: 5/5

  • This PR is safe to merge — it is a minimal, targeted correction of incorrect kwarg names in tests, with no changes to production code or test assertions.
  • The fix is straightforward and verifiable: the production function signatures (azure_api_key_header) are unchanged, and the test call sites are corrected to match. No assertions are weakened, no mocks are modified, and no production code is touched. The PR description includes passing test evidence.
  • No files require special attention

Important Files Changed

Filename Overview
tests/test_litellm/proxy/auth/test_user_api_key_auth.py Four test call sites corrected to use azure_api_key_header instead of AZURE_AI_API_KEY_header, matching the actual function signatures. No assertions or test logic changed.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[PR 24755 introduced regression] --> B[Tests used AZURE_AI_API_KEY_header kwarg]
    B --> C{Function signature check}
    C -->|get_api_key uses azure_api_key_header| D[TypeError at runtime]
    C -->|_user_api_key_auth_builder uses azure_api_key_header| D
    D --> E[This PR reverts to azure_api_key_header]
    E --> F[Tests pass successfully]
Loading

Reviews (1): Last reviewed commit: "[Fix] Correct kwarg name in test_user_ap..." | Re-trigger Greptile

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq bot commented Mar 30, 2026

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing litellm_fix_test_kwarg_name (6522d28) with main (f2deefe)

Open in CodSpeed

@yuneng-berri yuneng-berri enabled auto-merge March 30, 2026 22:35
@ryan-crabbe-berri ryan-crabbe-berri self-requested a review March 30, 2026 22:36
@yuneng-berri yuneng-berri merged commit c569d1f into main Mar 30, 2026
86 of 113 checks passed
@yuneng-berri yuneng-berri deleted the litellm_fix_test_kwarg_name branch March 30, 2026 22:37
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.

3 participants