Spaces:
Sleeping
Sleeping
File size: 701 Bytes
b7a913f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import os
os.environ["MOCK_INFERENCE"] = "true"
from fastapi.testclient import TestClient
from app import app
client = TestClient(app)
def test_invalid_model_load():
response = client.post("/v1/models/load", json={"model": "invalid-model-id"})
assert response.status_code == 400
assert "detail" in response.json()
assert "Invalid model ID" in response.json()["detail"]
def test_invalid_model_chat():
payload = {
"model": "invalid-model-id",
"messages": [{"role": "user", "content": "hello"}]
}
response = client.post("/v1/chat/completions", json=payload)
assert response.status_code == 400
assert "Invalid model ID" in response.json()["detail"]
|