(test) proxy_custom_auth use new exceptions

This commit is contained in:
ishaan-jaff 2024-01-23 17:36:13 -08:00
parent d2675a1ff3
commit b3ce0ac728
2 changed files with 7 additions and 6 deletions

View file

@ -13,4 +13,4 @@ async def user_api_key_auth(request: Request, api_key: str) -> UserAPIKeyAuth:
return UserAPIKeyAuth(api_key=api_key)
raise Exception
except:
raise Exception
raise Exception("Failed custom auth")

View file

@ -58,9 +58,10 @@ def test_custom_auth(client):
headers = {"Authorization": f"Bearer {token}"}
response = client.post("/chat/completions", json=test_data, headers=headers)
print(f"response: {response.text}")
assert response.status_code == 401
result = response.json()
print(f"Received response: {result}")
pytest.fail("LiteLLM Proxy test failed. This request should have been rejected")
except Exception as e:
pytest.fail("LiteLLM Proxy test failed. Exception", e)
print(vars(e))
print("got an exception")
assert e.code == 401
assert e.message == "Authentication Error, Failed custom auth"
pass