mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
(test) dynamoDB backwards compat
This commit is contained in:
parent
96c9fd3f02
commit
e2a7910113
1 changed files with 28 additions and 0 deletions
|
@ -472,3 +472,31 @@ def test_call_with_key_over_budget_stream(custom_db_client):
|
||||||
error_detail = e.message
|
error_detail = e.message
|
||||||
assert "Authentication Error, ExceededTokenBudget:" in error_detail
|
assert "Authentication Error, ExceededTokenBudget:" in error_detail
|
||||||
print(vars(e))
|
print(vars(e))
|
||||||
|
|
||||||
|
|
||||||
|
def test_dynamo_db_migration(custom_db_client):
|
||||||
|
# Tests the temporary patch we have in place
|
||||||
|
setattr(litellm.proxy.proxy_server, "custom_db_client", custom_db_client)
|
||||||
|
setattr(litellm.proxy.proxy_server, "master_key", "sk-1234")
|
||||||
|
try:
|
||||||
|
|
||||||
|
async def test():
|
||||||
|
bearer_token = (
|
||||||
|
"Bearer " + "sk-elJDL2pOEjcAuC7zD4psAg"
|
||||||
|
) # this works with ishaan's db, it's a never expiring key
|
||||||
|
|
||||||
|
request = Request(scope={"type": "http"})
|
||||||
|
request._url = URL(url="/chat/completions")
|
||||||
|
|
||||||
|
async def return_body():
|
||||||
|
return b'{"model": "azure-models"}'
|
||||||
|
|
||||||
|
request.body = return_body
|
||||||
|
|
||||||
|
# use generated key to auth in
|
||||||
|
result = await user_api_key_auth(request=request, api_key=bearer_token)
|
||||||
|
print("result from user auth with new key", result)
|
||||||
|
|
||||||
|
asyncio.run(test())
|
||||||
|
except Exception as e:
|
||||||
|
pytest.fail(f"An exception occurred - {str(e)}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue