litellm/tests
Alexsander Hamir f95572e3ed
Fix broken mocks in 6 flaky tests to prevent real API calls (#19829)
* Fix broken mocks in 6 flaky tests to prevent real API calls

Added network-level HTTP blocking using respx to prevent tests from making real API calls when Python-level mocks fail. This makes tests more reliable and retryable in CI.

Changes:

- Azure OIDC test: Added Azure Identity SDK mock to prevent real Azure calls

- Vector store test: Added @respx.mock decorator to block HTTP requests

- Resend email tests (3): Added @respx.mock decorator for all 3 test functions

- SendGrid email test: Added @respx.mock decorator

All test assertions and verification logic remain unchanged - only added safety nets to catch leaked API calls.

* Fix failing OIDC secret manager tests

Fixed two test failures in test_secret_managers_main.py:

1. test_oidc_azure_ad_token_success: Corrected the patch path for get_bearer_token_provider from 'litellm.secret_managers.get_azure_ad_token_provider.get_bearer_token_provider' to 'azure.identity.get_bearer_token_provider' since the function is imported from azure.identity.

2. test_oidc_google_success: Added @patch('httpx.Client') decorator to prevent any real HTTP connections during test execution, resolving httpx.ConnectError issues.

Both tests now pass successfully.
2026-01-26 17:39:40 -08:00
..
agent_tests
audio_tests
basic_proxy_startup_tests
batches_tests
code_coverage_tests Add test for Router.get_valid_args, fix router code coverage encoding (#19797) 2026-01-26 10:14:58 -08:00
documentation_tests fix: test_env_keys 2026-01-20 18:37:56 +05:30
enterprise updating promethus tests 2026-01-22 11:01:01 -08:00
guardrails_tests Merge branch 'main' into litellm_staging_01_19_2026 2026-01-20 19:19:36 +05:30
image_gen_tests Fix: imagegeneration@006 has been deprecated 2026-01-22 18:24:59 +05:30
litellm [Fix] UI Cost Estimator - Fix model dropdown (#19529) 2026-01-21 20:19:40 -08:00
litellm_core_utils fix(bedrock): deduplicate tool calls in assistant history (#15178) (#19324) 2026-01-19 10:56:49 -08:00
litellm_utils_tests feat: hashicorp vault rotate support 2026-01-23 17:32:55 +09:00
litellm-proxy-extras fix: add case-insensitive support for guardrail mode and actions (#19480) 2026-01-21 20:52:57 -08:00
llm_responses_api_testing Fix: Responses API logging error for StopIteration 2026-01-23 18:42:33 +05:30
llm_translation test_web_search 2026-01-24 11:06:23 -08:00
load_tests
local_testing test fixes 2026-01-24 14:27:56 -08:00
logging_callback_tests fix: add openinference span kinds to arize phoenix 2026-01-23 16:32:49 -05:00
mcp_tests [Feat] enable progress notifications for MCP tool calls (#19809) 2026-01-26 14:48:22 -08:00
multi_instance_e2e_tests
ocr_tests
old_proxy_tests/tests
openai_endpoints_tests
otel_tests
pass_through_tests
pass_through_unit_tests TestBedrockInvokeToolSearch 2026-01-24 15:36:30 -08:00
proxy_admin_ui_tests Make test_get_users_key_count deterministic by creating dedicated test user (#19795) 2026-01-26 10:13:15 -08:00
proxy_security_tests
proxy_unit_tests fix: server rooth path (#19790) 2026-01-26 09:48:06 -08:00
router_unit_tests Add test for Router.get_valid_args, fix router code coverage encoding (#19797) 2026-01-26 10:14:58 -08:00
scim_tests
search_tests skip brave tests 2026-01-22 10:50:23 -08:00
spend_tracking_tests increasing time for spend tracking 2026-01-20 16:31:25 -08:00
store_model_in_db_tests
test_litellm Fix broken mocks in 6 flaky tests to prevent real API calls (#19829) 2026-01-26 17:39:40 -08:00
unified_google_tests Revert "[Infra] Changing Google Tests to use Gemini 3 Flash Preview" 2026-01-20 17:32:10 -08:00
vector_store_tests
windows_tests
__init__.py
gettysburg.wav
large_text.py
openai_batch_completions.jsonl
README.MD
test_budget_management.py
test_callbacks_on_proxy.py
test_config.py
test_debug_warning.py
test_default_encoding_non_root.py fix: resolve Read-only file system error in non-root images (#19449) 2026-01-20 19:00:52 -08:00
test_end_users.py
test_entrypoint.py
test_fallbacks.py
test_gpt5_azure_temperature_support.py
test_health.py
test_keys.py Adding retries to flaky tests 2026-01-22 15:21:44 -08:00
test_litellm_proxy_responses_config.py
test_logging.conf
test_models.py
test_openai_endpoints.py
test_organizations.py Adding retries to flaky tests 2026-01-22 15:21:44 -08:00
test_passthrough_endpoints.py
test_proxy_server_non_root.py deactivating non root tests 2026-01-23 22:55:36 -08:00
test_ratelimit.py
test_resource_cleanup.py
test_service_logger_otel.py fix(langfuse_otel): ignore service logs and fix callback shadowing (#19298) 2026-01-19 05:53:47 -08:00
test_spend_logs.py
test_team_logging.py
test_team_members.py
test_team.py test_team_update_sc_2 2026-01-24 13:17:32 -08:00
test_users.py

In total litellm runs 1000+ tests

[02/20/2025] Update:

To make it easier to contribute and map what behavior is tested,

we've started mapping the litellm directory in tests/test_litellm

This folder can only run mock tests.