mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 18:24:20 +00:00
(test) test key/generate against deployed proxy
This commit is contained in:
parent
02c166138f
commit
9b04b1c9ad
1 changed files with 18 additions and 3 deletions
|
@ -10,13 +10,13 @@ import os, io
|
|||
sys.path.insert(
|
||||
0, os.path.abspath("../..")
|
||||
) # Adds the parent directory to the system path
|
||||
import pytest, logging
|
||||
import pytest, logging, requests
|
||||
import litellm
|
||||
from litellm import embedding, completion, completion_cost, Timeout
|
||||
from litellm import RateLimitError
|
||||
|
||||
|
||||
def test_add_new_key(client):
|
||||
def test_add_new_key():
|
||||
try:
|
||||
# Your test data
|
||||
test_data = {
|
||||
|
@ -29,10 +29,25 @@ def test_add_new_key(client):
|
|||
token = os.getenv("PROXY_MASTER_KEY")
|
||||
|
||||
headers = {"Authorization": f"Bearer {token}"}
|
||||
response = client.post("/key/generate", json=test_data, headers=headers)
|
||||
|
||||
staging_endpoint = "https://litellm-litellm-pr-1366.up.railway.app"
|
||||
|
||||
# Your bearer token
|
||||
token = os.getenv("PROXY_MASTER_KEY")
|
||||
|
||||
headers = {"Authorization": f"Bearer {token}"}
|
||||
|
||||
# Make a request to the staging endpoint
|
||||
response = requests.post(
|
||||
staging_endpoint + "/key/generate", json=test_data, headers=headers
|
||||
)
|
||||
|
||||
print(f"response: {response.text}")
|
||||
assert response.status_code == 200
|
||||
result = response.json()
|
||||
except Exception as e:
|
||||
print(traceback.format_exc())
|
||||
pytest.fail(f"An error occurred {e}")
|
||||
|
||||
|
||||
# test_add_new_key()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue