1
- import sys , os
1
+ import os
2
+ import sys
2
3
import traceback
4
+
3
5
from dotenv import load_dotenv
4
6
5
7
load_dotenv ()
6
- import os , io
8
+ import io
9
+ import os
7
10
8
11
# this file is to test litellm/proxy
9
12
10
13
sys .path .insert (
11
14
0 , os .path .abspath ("../.." )
12
15
) # 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
17
20
18
21
# test /chat/completion request to the proxy
19
22
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 ,
22
29
router ,
23
30
save_worker_config ,
24
- initialize ,
25
- ProxyConfig ,
26
- ) # Replace with the actual module where your FastAPI router is defined
31
+ )
27
32
28
33
29
34
# Here you create a fixture that will be used by your tests
@@ -62,7 +67,7 @@ def test_custom_auth(client):
62
67
except Exception as e :
63
68
print (vars (e ))
64
69
print ("got an exception" )
65
- assert e .code == 401
70
+ assert e .code == " 401"
66
71
assert e .message == "Authentication Error, Failed custom auth"
67
72
pass
68
73
@@ -86,7 +91,7 @@ def test_custom_auth_bearer(client):
86
91
except Exception as e :
87
92
print (vars (e ))
88
93
print ("got an exception" )
89
- assert e .code == 401
94
+ assert e .code == " 401"
90
95
assert (
91
96
e .message
92
97
== "Authentication Error, CustomAuth - Malformed API Key passed in. Ensure Key has `Bearer` prefix"
0 commit comments