The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix custom auth test
Ishaan Jaffd611e5817cba
diff --git a/litellm/tests/test_proxy_custom_auth.py b/litellm/tests/test_proxy_custom_auth.pyindex d4c39e3d5d6..cffcc2e7f2c 100644--- a/litellm/tests/test_proxy_custom_auth.py+++ b/litellm/tests/test_proxy_custom_auth.py@@ -1,29 +1,34 @@-import sys, os+import os+import sysimport traceback+from dotenv import load_dotenvload_dotenv()-import os, io+import io+import os# this file is to test litellm/proxysys.path.insert(0, os.path.abspath("../..")) # Adds the parent directory to the system path-import pytest, asyncio-import litellm-from litellm import embedding, completion, completion_cost, Timeout-from litellm import RateLimitError+import asyncio++import pytest+from fastapi import FastAPI# test /chat/completion request to the proxyfrom fastapi.testclient import TestClient-from fastapi import FastAPI-from litellm.proxy.proxy_server import (++import litellm+from litellm import RateLimitError, Timeout, completion, completion_cost, embedding+from litellm.proxy.proxy_server import ( # Replace with the actual module where your FastAPI router is defined+ ProxyConfig,+ initialize,router,save_worker_config,- initialize,- ProxyConfig,-) # Replace with the actual module where your FastAPI router is defined+)# Here you create a fixture that will be used by your tests@@ -62,7 +67,7 @@ def test_custom_auth(client):except Exception as e:print(vars(e))print("got an exception")- assert e.code == 401+ assert e.code == "401"assert e.message == "Authentication Error, Failed custom auth"pass@@ -86,7 +91,7 @@ def test_custom_auth_bearer(client):except Exception as e:print(vars(e))print("got an exception")- assert e.code == 401+ assert e.code == "401"assert (e.message== "Authentication Error, CustomAuth - Malformed API Key passed in. Ensure Key has `Bearer` prefix"