claudex/tests/test_health.py
Nenad Ilic 12e39cf7c9 Initial commit with functional proxy and tests
- Create claudex proxy for Anthropic-to-OpenAI API conversion
- Fix package setup in pyproject.toml
- Add environment variable mocking in tests
- Include example configuration
2025-04-26 14:17:27 +02:00

21 lines
588 B
Python

from fastapi.testclient import TestClient
import unittest.mock
import os
# Mock environment variables before importing app
with unittest.mock.patch.dict(os.environ, {
'TARGET_API_BASE': 'https://api.example.com',
'TARGET_API_KEY': 'mock-api-key',
'BIG_MODEL_TARGET': 'model-large',
'SMALL_MODEL_TARGET': 'model-small'
}):
from claudex.proxy import app
def test_health_check():
client = TestClient(app)
response = client.get("/")
assert response.status_code == 200
data = response.json()
assert data["status"] == "ok"
assert "message" in data