Skip to content

fix(proxy): Fix test_mock_create_audio_file by adding managed_files hook #12072

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

Merged

Conversation

colesmcintosh
Copy link
Collaborator

Title

Fix test_mock_create_audio_file by adding managed_files hook

Relevant issues

Fixes failing test in CI

Pre-Submission checklist

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🐛 Bug Fix

Changes

The test_mock_create_audio_file test was failing with:

AssertionError: Azure call not found with expected parameters. Calls: []

The root cause was that the managed_files hook was not configured in the test setup, causing the files endpoint to return a 500 error ("Managed files hook not found") before reaching the mocked create_file function.

This PR fixes the test by:

  1. Creating a DummyManagedFiles class that implements BaseFileEndpoints
  2. Adding it to proxy_logging_obj.proxy_hook_mapping to bypass the enterprise feature check
  3. Properly mocking litellm.files.main.create_file as an AsyncMock
  4. Handling both dict and object forms of create_file_request

Test Results

tests/test_litellm/proxy/openai_files_endpoint/test_files_endpoint.py::test_mock_create_audio_file PASSED [100%]

The test was failing because the managed_files hook was not configured.
This fix adds a DummyManagedFiles class and mocks the create_file
function as an AsyncMock to ensure proper test execution.
Copy link

vercel bot commented Jun 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 26, 2025 4:47pm

@ishaan-jaff
Copy link
Contributor

@colesmcintosh please merge once the mock tests pass

@colesmcintosh colesmcintosh merged commit 7b7472d into BerriAI:main Jun 26, 2025
6 checks passed
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