(test) update prisma test

This commit is contained in:
ishaan-jaff 2024-01-23 17:30:01 -08:00
parent 5702be1601
commit 37dd1114f2

View file

@ -136,8 +136,8 @@ def test_call_with_invalid_key(prisma_client):
asyncio.run(test())
except Exception as e:
print("Got Exception", e)
print(e.detail)
assert "Authentication Error" in e.detail
print(e.message)
assert "Authentication Error" in e.message
pass
@ -171,7 +171,7 @@ def test_call_with_invalid_model(prisma_client):
asyncio.run(test())
except Exception as e:
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"
)
pass
@ -274,7 +274,7 @@ def test_call_with_user_over_budget(prisma_client):
asyncio.run(test())
except Exception as e:
error_detail = e.detail
error_detail = e.message
assert "Authentication Error, ExceededBudget:" in error_detail
print(vars(e))
@ -350,7 +350,7 @@ def test_call_with_user_over_budget_stream(prisma_client):
asyncio.run(test())
except Exception as e:
error_detail = e.detail
error_detail = e.message
assert "Authentication Error, ExceededBudget:" in error_detail
print(vars(e))
@ -414,8 +414,8 @@ def test_generate_and_call_with_expired_key(prisma_client):
asyncio.run(test())
except Exception as e:
print("Got Exception", e)
print(e.detail)
assert "Authentication Error" in e.detail
print(e.message)
assert "Authentication Error" in e.message
pass
@ -486,8 +486,8 @@ def test_delete_key_auth(prisma_client):
asyncio.run(test())
except Exception as e:
print("Got Exception", e)
print(e.detail)
assert "Authentication Error" in e.detail
print(e.message)
assert "Authentication Error" in e.message
pass
@ -599,7 +599,7 @@ def test_generate_and_update_key(prisma_client):
asyncio.run(test())
except Exception as e:
print("Got Exception", e)
print(e.detail)
print(e.message)
pytest.fail(f"An exception occurred - {str(e)}")
@ -665,11 +665,11 @@ def test_key_generate_with_custom_auth(prisma_client):
except Exception as e:
# this should fail
print("Got Exception", e)
print(e.detail)
print(e.message)
print("First request failed!. This is expected")
assert (
"This violates LiteLLM Proxy Rules. No team id provided."
in e.detail
in e.message
)
request_2 = GenerateKeyRequest(
@ -683,7 +683,7 @@ def test_key_generate_with_custom_auth(prisma_client):
asyncio.run(test())
except Exception as e:
print("Got Exception", e)
print(e.detail)
print(e.message)
pytest.fail(f"An exception occurred - {str(e)}")
@ -752,7 +752,7 @@ def test_call_with_key_over_budget(prisma_client):
asyncio.run(test())
except Exception as e:
error_detail = e.detail
error_detail = e.message
assert "Authentication Error, ExceededTokenBudget:" in error_detail
print(vars(e))
@ -827,6 +827,6 @@ def test_call_with_key_over_budget_stream(prisma_client):
pytest.fail(f"This should have failed!. They key crossed it's budget")
except Exception as e:
error_detail = e.detail
error_detail = e.message
assert "Authentication Error, ExceededTokenBudget:" in error_detail
print(vars(e))