mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 03:34:10 +00:00
(test) auth errors - OpenAI compatible
This commit is contained in:
parent
b03a751418
commit
9cbc388bd9
2 changed files with 18 additions and 18 deletions
|
@ -104,8 +104,8 @@ def test_call_with_invalid_key(custom_db_client):
|
||||||
asyncio.run(test())
|
asyncio.run(test())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Got Exception", e)
|
print("Got Exception", e)
|
||||||
print(e.detail)
|
print(e.message)
|
||||||
assert "Authentication Error" in e.detail
|
assert "Authentication Error" in e.message
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ def test_call_with_invalid_model(custom_db_client):
|
||||||
asyncio.run(test())
|
asyncio.run(test())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
assert (
|
assert (
|
||||||
e.detail
|
e.message
|
||||||
== "Authentication Error, API Key not allowed to access model. This token can only access models=['mistral']. Tried to access gemini-pro-vision"
|
== "Authentication Error, API Key not allowed to access model. This token can only access models=['mistral']. Tried to access gemini-pro-vision"
|
||||||
)
|
)
|
||||||
pass
|
pass
|
||||||
|
@ -240,7 +240,7 @@ def test_call_with_key_over_budget(custom_db_client):
|
||||||
|
|
||||||
asyncio.run(test())
|
asyncio.run(test())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_detail = e.detail
|
error_detail = e.message
|
||||||
assert "Authentication Error, ExceededBudget:" in error_detail
|
assert "Authentication Error, ExceededBudget:" in error_detail
|
||||||
print(vars(e))
|
print(vars(e))
|
||||||
|
|
||||||
|
@ -312,6 +312,6 @@ def test_call_with_key_over_budget_stream(custom_db_client):
|
||||||
|
|
||||||
asyncio.run(test())
|
asyncio.run(test())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_detail = e.detail
|
error_detail = e.message
|
||||||
assert "Authentication Error, ExceededBudget:" in error_detail
|
assert "Authentication Error, ExceededBudget:" in error_detail
|
||||||
print(vars(e))
|
print(vars(e))
|
||||||
|
|
|
@ -132,8 +132,8 @@ def test_call_with_invalid_key(prisma_client):
|
||||||
asyncio.run(test())
|
asyncio.run(test())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Got Exception", e)
|
print("Got Exception", e)
|
||||||
print(e.detail)
|
print(e.message)
|
||||||
assert "Authentication Error" in e.detail
|
assert "Authentication Error" in e.message
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ def test_call_with_invalid_model(prisma_client):
|
||||||
asyncio.run(test())
|
asyncio.run(test())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
assert (
|
assert (
|
||||||
e.detail
|
e.message
|
||||||
== "Authentication Error, API Key not allowed to access model. This token can only access models=['mistral']. Tried to access gemini-pro-vision"
|
== "Authentication Error, API Key not allowed to access model. This token can only access models=['mistral']. Tried to access gemini-pro-vision"
|
||||||
)
|
)
|
||||||
pass
|
pass
|
||||||
|
@ -269,7 +269,7 @@ def test_call_with_key_over_budget(prisma_client):
|
||||||
|
|
||||||
asyncio.run(test())
|
asyncio.run(test())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_detail = e.detail
|
error_detail = e.message
|
||||||
assert "Authentication Error, ExceededBudget:" in error_detail
|
assert "Authentication Error, ExceededBudget:" in error_detail
|
||||||
print(vars(e))
|
print(vars(e))
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ def test_call_with_key_over_budget_stream(prisma_client):
|
||||||
|
|
||||||
asyncio.run(test())
|
asyncio.run(test())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_detail = e.detail
|
error_detail = e.message
|
||||||
assert "Authentication Error, ExceededBudget:" in error_detail
|
assert "Authentication Error, ExceededBudget:" in error_detail
|
||||||
print(vars(e))
|
print(vars(e))
|
||||||
|
|
||||||
|
@ -408,8 +408,8 @@ def test_generate_and_call_with_expired_key(prisma_client):
|
||||||
asyncio.run(test())
|
asyncio.run(test())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Got Exception", e)
|
print("Got Exception", e)
|
||||||
print(e.detail)
|
print(e.message)
|
||||||
assert "Authentication Error" in e.detail
|
assert "Authentication Error" in e.message
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -480,8 +480,8 @@ def test_delete_key_auth(prisma_client):
|
||||||
asyncio.run(test())
|
asyncio.run(test())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Got Exception", e)
|
print("Got Exception", e)
|
||||||
print(e.detail)
|
print(e.message)
|
||||||
assert "Authentication Error" in e.detail
|
assert "Authentication Error" in e.message
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -593,7 +593,7 @@ def test_generate_and_update_key(prisma_client):
|
||||||
asyncio.run(test())
|
asyncio.run(test())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Got Exception", e)
|
print("Got Exception", e)
|
||||||
print(e.detail)
|
print(e.message)
|
||||||
pytest.fail(f"An exception occurred - {str(e)}")
|
pytest.fail(f"An exception occurred - {str(e)}")
|
||||||
|
|
||||||
|
|
||||||
|
@ -659,11 +659,11 @@ def test_key_generate_with_custom_auth(prisma_client):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# this should fail
|
# this should fail
|
||||||
print("Got Exception", e)
|
print("Got Exception", e)
|
||||||
print(e.detail)
|
print(e.message)
|
||||||
print("First request failed!. This is expected")
|
print("First request failed!. This is expected")
|
||||||
assert (
|
assert (
|
||||||
"This violates LiteLLM Proxy Rules. No team id provided."
|
"This violates LiteLLM Proxy Rules. No team id provided."
|
||||||
in e.detail
|
in e.message
|
||||||
)
|
)
|
||||||
|
|
||||||
request_2 = GenerateKeyRequest(
|
request_2 = GenerateKeyRequest(
|
||||||
|
@ -677,5 +677,5 @@ def test_key_generate_with_custom_auth(prisma_client):
|
||||||
asyncio.run(test())
|
asyncio.run(test())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Got Exception", e)
|
print("Got Exception", e)
|
||||||
print(e.detail)
|
print(e.message)
|
||||||
pytest.fail(f"An exception occurred - {str(e)}")
|
pytest.fail(f"An exception occurred - {str(e)}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue