You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.2 KiB
Markdown
41 lines
1.2 KiB
Markdown
# quotesdb Integration Tests
|
|
|
|
Integration tests for the quotesdb API, located in this directory.
|
|
|
|
## Running
|
|
|
|
```sh
|
|
# From quotesdb/
|
|
cargo test
|
|
```
|
|
|
|
Integration tests run automatically as part of `cargo test`.
|
|
|
|
## Structure
|
|
|
|
Each test file focuses on one area of the API:
|
|
|
|
| File | Coverage |
|
|
|---|---|
|
|
| `api_spec.rs` | GET /api/ — OpenAPI spec shape |
|
|
| `quotes_list.rs` | GET /api/quotes — pagination, filters |
|
|
| `quotes_random.rs` | GET /api/quotes/random — 200 and empty DB |
|
|
| `quotes_crud.rs` | PUT, POST, DELETE — create, update, delete |
|
|
| `auth.rs` | Auth code validation, 403 responses |
|
|
| `tags.rs` | Tag create, filter, replace on update |
|
|
| `router_order.rs` | `/random` not matched as `:id` |
|
|
|
|
## Test harness
|
|
|
|
All tests use a shared harness (`harness.rs`) that:
|
|
1. Creates a temporary SQLite database
|
|
2. Spawns an Axum server on a random port
|
|
3. Returns the server address for `reqwest` clients to hit
|
|
4. Cleans up the database on drop
|
|
|
|
## Notes
|
|
|
|
- Tests require no external services — all run against a local SQLite database
|
|
- Each test gets its own isolated database to avoid state contamination
|
|
- The API server target must build natively (`cargo test` uses the host target)
|