mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-12 03:48:56 +00:00
* test: migrate tests/proxy_behavior into integration and unit tiers (partial) * test(integration): run settings-dependent management tests on an owned proxy * test(integration): assert stored values in the rewritten management rows * test(integration): pin sibling team allocations against the org guaranteed throughput cap * test(integration): keep Prisma clients out of the shared integration conftest import path --------- Co-authored-by: yuneng <yuneng@berri.ai>
22 lines
695 B
Python
22 lines
695 B
Python
import pytest
|
|
|
|
|
|
pytestmark = pytest.mark.asyncio(loop_scope="session")
|
|
|
|
|
|
async def test_key_generate_lands_in_db(gateway_client, db, resources):
|
|
from litellm.proxy.utils import hash_token
|
|
|
|
resp = await gateway_client.post(
|
|
"/key/generate",
|
|
headers={"Authorization": f"Bearer {gateway_client.gateway.key}"},
|
|
json={"key_alias": resources.prefix},
|
|
)
|
|
assert resp.status_code == 200, resp.text
|
|
cleartext = resp.json()["key"]
|
|
assert cleartext.startswith("sk-")
|
|
|
|
hashed = hash_token(cleartext)
|
|
row = await db.db.litellm_verificationtoken.find_unique(where={"token": hashed})
|
|
assert row is not None
|
|
assert row.token == hashed != cleartext
|