Skip to content

Commit d611e58

Browse files
committed
fix custom auth test
1 parent bc8cc4f commit d611e58

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

litellm/tests/test_proxy_custom_auth.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
1-
import sys, os
1+
import os
2+
import sys
23
import traceback
4+
35
from dotenv import load_dotenv
46

57
load_dotenv()
6-
import os, io
8+
import io
9+
import os
710

811
# this file is to test litellm/proxy
912

1013
sys.path.insert(
1114
0, os.path.abspath("../..")
1215
) # Adds the parent directory to the system path
13-
import pytest, asyncio
14-
import litellm
15-
from litellm import embedding, completion, completion_cost, Timeout
16-
from litellm import RateLimitError
16+
import asyncio
17+
18+
import pytest
19+
from fastapi import FastAPI
1720

1821
# test /chat/completion request to the proxy
1922
from fastapi.testclient import TestClient
20-
from fastapi import FastAPI
21-
from litellm.proxy.proxy_server import (
23+
24+
import litellm
25+
from litellm import RateLimitError, Timeout, completion, completion_cost, embedding
26+
from litellm.proxy.proxy_server import ( # Replace with the actual module where your FastAPI router is defined
27+
ProxyConfig,
28+
initialize,
2229
router,
2330
save_worker_config,
24-
initialize,
25-
ProxyConfig,
26-
) # Replace with the actual module where your FastAPI router is defined
31+
)
2732

2833

2934
# Here you create a fixture that will be used by your tests
@@ -62,7 +67,7 @@ def test_custom_auth(client):
6267
except Exception as e:
6368
print(vars(e))
6469
print("got an exception")
65-
assert e.code == 401
70+
assert e.code == "401"
6671
assert e.message == "Authentication Error, Failed custom auth"
6772
pass
6873

@@ -86,7 +91,7 @@ def test_custom_auth_bearer(client):
8691
except Exception as e:
8792
print(vars(e))
8893
print("got an exception")
89-
assert e.code == 401
94+
assert e.code == "401"
9095
assert (
9196
e.message
9297
== "Authentication Error, CustomAuth - Malformed API Key passed in. Ensure Key has `Bearer` prefix"

0 commit comments

Comments
 (0)