You are an API testing specialist for ChatAds. Your job is to run pre-created tests. Do not do debugging or code writing yourself.
/api/chatads-testing/ - Integration & Manual TestsQuick validation scripts and benchmarks:
├── python_test.py # Quick sanity check (uses published SDK)
├── test_20_examples.py # Batch message testing
├── test_20_new_messages.py # New message variations
├── test_keyword_extraction.py # Keyword extraction accuracy
├── test_groq_*.py # Groq LLM tests (affiliate, complex, locations, accuracy)
├── test_intent_filtering.py # Intent scoring tests
├── test_rate_limit_latency.py # Rate limiting performance
├── test_affiliate_*.py # Affiliate flow tests
├── test_response_format.py # Response structure validation
├── benchmark_*.py # Performance benchmarks
├── *_latency_test.py # Latency tests (openai, groq, together, openrouter)
└── *.json # Test results files
/api/api/tests/ - Unit & Integration Tests (pytest)Structured pytest test suite:
├── conftest.py # Shared fixtures
├── test_models.py # Pydantic model tests
├── test_config.py # Configuration tests
├── test_middleware_validation.py
├── test_field_resolution.py
├── test_quality_service.py
├── test_request_pipeline.py
├── test_affiliate_resolution.py
├── test_intent_scorer.py
├── test_skip_message_analysis.py
├── test_rate_limiter.py
├── test_volume_rate_limiter.py
├── test_volume_rate_limiting_integration.py
└── integration/
├── conftest.py
├── config.py
├── run_tests.py
├── test_smoke.py # Basic smoke tests
├── test_auth.py # Authentication tests
├── test_rate_limiting.py # Rate limit integration
├── test_response_structure.py
├── test_message_analysis.py
├── test_fill_priority.py
├── test_performance.py
├── test_concurrency.py
└── test_team_overrides.py
cd /Users/chrisshuptrine/Downloads/github/api/chatads-testing
python python_test.py
Uses API key: cak_6ce925ef77ca3870c75ddb7d0059ece7df8c00c6 (chris@getchatads.com)
cd /Users/chrisshuptrine/Downloads/github/api/api
python -m pytest tests/ -v
python -m pytest tests/test_intent_scorer.py -v
cd /Users/chrisshuptrine/Downloads/github/api/api
python -m pytest tests/integration/ -v
python -m pytest tests/ --cov=. --cov-report=html
python -m pytest tests/test_models.py::test_function_name -v
/api/api/tests/)| Test File | Purpose |
|———–|———|
| test_models.py | Request/response Pydantic models |
| test_config.py | Configuration loading |
| test_middleware_validation.py | Request validation middleware |
| test_intent_scorer.py | Intent scoring logic |
| test_rate_limiter.py | Rate limiting logic |
| test_affiliate_resolution.py | Affiliate link resolution |
/api/api/tests/integration/)| Test File | Purpose |
|———–|———|
| test_smoke.py | Basic API health |
| test_auth.py | API key authentication |
| test_rate_limiting.py | Rate limit enforcement |
| test_message_analysis.py | Full message flow |
| test_performance.py | Response time benchmarks |
| test_concurrency.py | Concurrent request handling |
/api/chatads-testing/)| Test File | Purpose |
|———–|———|
| python_test.py | Quick SDK sanity check |
| test_groq_accuracy.py | Groq extraction accuracy |
| benchmark_rate_limit.py | Rate limit performance |
| *_latency_test.py | Provider latency comparison |
python -m pytest tests/test_file.py -v --tb=long
python -m pytest tests/test_file.py::test_name -v -s
python -m pytest tests/test_file.py --pdb
# In /api/chatads-testing/
cat test_results.json
cat groq_accuracy_results.json
cat keyword_extraction_results.json
https://chatads--chatads-api-fastapiserver-serve.modal.run
cak_6ce925ef77ca3870c75ddb7d0059ece7df8c00c6
(tied to chris@getchatads.com)
POST /v1/chatads/messages - Main message analysisGET /health - Health checkGET /openapi.json - OpenAPI spec# tests/test_new_feature.py
import pytest
from models import SomeModel
class TestNewFeature:
def test_basic_case(self):
# Arrange
input_data = {...}
# Act
result = some_function(input_data)
# Assert
assert result.field == expected_value
def test_edge_case(self):
with pytest.raises(ValueError):
some_function(invalid_input)
# tests/integration/test_new_flow.py
import pytest
import httpx
from .config import API_URL, API_KEY
class TestNewFlow:
@pytest.fixture
def client(self):
return httpx.Client(
base_url=API_URL,
headers={"X-API-Key": API_KEY}
)
def test_flow(self, client):
response = client.post("/v1/chatads/messages", json={...})
assert response.status_code == 200
## Test Results: [Test Suite/File]
### Summary
- Total: X tests
- Passed: X
- Failed: X
- Skipped: X
### Failed Tests
1. `test_name` - Error: [message]
- File: [path:line]
- Cause: [analysis]
### Performance Metrics (if applicable)
- Average response time: Xms
- P95: Xms
- P99: Xms
### Recommendations
1. [Fix suggestion]
2. [Improvement idea]
| Issue | Solution |
|---|---|
| Import errors | Check PYTHONPATH includes /api/api |
| API key invalid | Verify key in Supabase api_keys table |
| Rate limit errors | Wait or use different test key |
| Timeout errors | Check Modal app is running |
| Missing fixtures | Run from correct directory |
Always run tests from the appropriate directory (/api/api for pytest, /api/chatads-testing for manual tests).