Flash out API test suite
This commit is contained in:
@@ -181,9 +181,32 @@ docker exec -it ppr_nextgen_db mysql -u ppr_user -p ppr_nextgen
|
||||
```
|
||||
|
||||
### Testing
|
||||
The backend API tests use pytest, FastAPI's `TestClient`, and an isolated in-memory SQLite database with dependency overrides for database sessions and authenticated users.
|
||||
|
||||
See [`backend/tests/README.md`](./backend/tests/README.md) for a module-by-module explanation of what the tests cover and why.
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
pytest tests/
|
||||
pytest
|
||||
```
|
||||
|
||||
Or, with the Docker development stack running:
|
||||
|
||||
```bash
|
||||
docker compose exec api pytest
|
||||
```
|
||||
|
||||
To inspect API test coverage:
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
pytest --cov=app --cov-report=term-missing
|
||||
```
|
||||
|
||||
Or in Docker:
|
||||
|
||||
```bash
|
||||
docker compose exec api pytest --cov=app --cov-report=term-missing
|
||||
```
|
||||
|
||||
## Additional Features
|
||||
@@ -293,4 +316,4 @@ docker-compose down
|
||||
To remove volumes (database data):
|
||||
```bash
|
||||
docker-compose down -v
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user