File size: 1,350 Bytes
8c0b652
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Test Suite

Comprehensive test coverage for the LinguaCustodia Financial AI API.

## Running Tests

### Prerequisites
1. Start the API server: `python app_clean.py`
2. Install test dependencies: `pip install pytest requests`

### Run Tests
```bash
# Run all tests
pytest tests/

# Run specific test files
pytest tests/test_api.py
pytest tests/test_inference.py
pytest tests/test_openai_compatibility.py

# Run with verbose output
pytest tests/ -v

# Run with coverage
pytest tests/ --cov=app
```

## Test Categories

### `test_api.py`
- Health check endpoint
- Models listing endpoints
- Import diagnosis endpoint
- Basic API functionality

### `test_inference.py`
- Basic inference functionality
- Different model parameters
- Error handling
- Performance timing

### `test_openai_compatibility.py`
- Chat completions endpoint
- Text completions endpoint
- JSON response format
- Streaming responses
- RAG document analysis

## Test Configuration

Tests automatically skip if the API server is not running. The `conftest.py` file handles:
- API availability checking
- Automatic test skipping
- Common fixtures

## Expected Behavior

All tests should pass when the API is running properly. Tests cover:
- βœ… API endpoint availability
- βœ… Response format validation
- βœ… OpenAI compatibility
- βœ… Error handling
- βœ… Performance expectations